Generate project based on Maven Archetype

 

1: Generate an archetype locally

Open the CMD window, navigate to the root directory of the project, and execute the command: mvn archetype:create-from-project  will generate generated-sources in the target directory, then enter the generated-sources\archetype directory, and execute the command: mvn install . This generates an archetype locally.

2: Create a project from the local archetype

Open the CMD window and execute the command: mvn archetype:generate -DarchetypeCatalog=local , it will list all the local archetypes and select the serial number to create the corresponding project. Proceed as follows:

  1. Select the template corresponding to the serial number
  2. groupId such as com.project
  3. artifactId, like demo
  4. version, 如1.0.0-SNAPSHOT
  5. package, Nyo com.project.demo

3: Book in addition to the local archetype

Delete the corresponding byte segment in the archetype-catalog.xml file under the /.m2 directory, and delete the files under the corresponding groupId and artifactId in the local warehouse.

 

Guess you like

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