Create MAVEN project template

Overview

Under normal circumstances, we will use maven to manage the jar package of the project, and rarely automatically generate engineering projects through the project template that comes with maven. Because each company has its own set of fixed engineering project templates, how to create projects through its own engineering project templates?

Template creation steps

Take the java project as an example to create your own local project template. The specific steps are as follows:

  • Open the Eclipse tool and create a normal Java project.

  • Right-click on the project and convert it to a maven project, as shown in the following figure.

At this point, the project has become a maven project with the following structure:

 

  • Enter the project directory and use the maven command to generate the maven project template. The maven environment must be installed in advance. It is actually very simple. Download the decompressed version of maven and configure maven_home.

The execution command log is as follows:

At this time, the maven project template has been generated from the project demo, specifically under the path of E:\01.WorkDocument\workspace\workspace-sts\jup\demo-template\target\generated-sources\archetype.

 

  • Install the template to the local private server, enter the archetype directory, and execute mvn clean install.

At this point, the template has been installed on the private server, as shown in the following figure:

  • Using this template, create a new project, create a new folder locally, and enter the folder to execute the mvn archetype:generate -DarchetypeCatalog=local command. All our templates are listed:

Select the template and fill in the relevant information, as shown in the following figure:

You're done! ! !

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326106471&siteId=291194637