Search This Blog

Sunday, November 18, 2018

Create a new basic Java Maven package

To create a basic Maven package, open a terminal (command-line) window and run:

Replace org.example.basicapp with the full package namespace of your application, and myapp with the name of your project (this will become the name of the directory for your project).
By default, Maven creates a project template for you using the quickstart archetype, which is a good starting place for many projects. There are more archetypes available; visit the Maven archetypes page for a list of archetypes packaged with Maven. You can choose a particular archetype to use by adding the -DarchetypeArtifactIdargument to the archetype:generate command. For example:
mvn archetype:generate \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-webapp \ -DgroupId=org.example.webapp \ -DartifactId=mywebapp
Much more information about creating and configuring Maven projects is provided in the Maven Getting Started Guide.