Maven - archetypes

Maven Archetypes

https://maven.apache.org/guides/introduction/introduction-to-archetypes.html

If you have an existing application and wish to use it as a template for some other new applications that are not created yet, you can create an archetype from the existing application and then use that archetype to generate new applications using the command below.

mvn archetype: generate
-DarchetypeGroupId=com.companyName.domainName
-DarchetypeArtifactId=domain-archetype
-DarchetypeVersion=1.0.0-SNAPSHOT
-DgroupId=com.companyname.domainname
-DartifactId=application-name
-Dversion=1.0.0-SNAPSHOT
-Dpackage=com.companyname.domainname.application.whateverelseyouwanttoaddhere
-Dinvoker=ApplicationName
-DspecName=application-name
-Dport=8002
-Dtitle="Application Name API"
-B

Create an empty java project from terminal using maven archetypes

mvn archetype:generate -DgroupId=com.my.company -DartifactId=test-java-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Reference:

  1. https://maven.apache.org/archetypes/index.html
  2. https://maven.apache.org/archetypes/maven-archetype-quickstart/
  3. https://maven.apache.org/guides/mini/guide-creating-archetypes.html

Links to this note