Getting Started with Maven | Creating a Maven Project | Project Creation (archetype:generate)

When developing with Maven, the first thing to do is create a project. This is done with a Maven command.

Open a command prompt or terminal, and move to the directory where you want to create the project. Use cd {working-directory} to move to the working directory, then run the following command.

$ mvn archetype:generate

After a short wait, a long list of text is displayed. This is the list of available project templates. There are more than 1,000 templates, so if you are not familiar with Maven, you can ignore most of it.

$ mvn archetype:generate
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> am.ik.archetype:maven-reactjs-blank-archetype (Blank Project for React.js)
2: remote -> am.ik.archetype:msgpack-rpc-jersey-blank-archetype (Blank Project for Spring Boot + Jersey)
3: remote -> am.ik.archetype:mvc-1.0-blank-archetype (MVC 1.0 Blank Project)

... omitted ...

2012: remote -> us.fatehi:schemacrawler-archetype-plugin-lint (-)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 1095: 

If you press Enter or Return as-is, the maven-archetype-quickstart template is selected.

This is the quick-start template used when creating a Maven project. It is the most basic template for Maven projects. After selecting maven-archetype-quickstart, Maven asks for project information one item at a time.

maven-archetype-quickstart Version

Choose the version of org.apache.maven.archetypes:maven-archetype-quickstart.

1 : 1.0-alpha-1
2 : 1.0-alpha-2
3 : 1.0-alpha-3
4 : 1.0-alpha-4
5 : 1.0
6 : 1.1
Choose a number : 6 :

Maven first asks for the maven-archetype-quickstart version. The latest version is selected by default, so press Enter or Return.

Group ID

Define value for property 'groupId': :

The group ID identifies the individual or organization that creates the project. In this example, enter com.devkuma.

Artifact ID

Define value for property 'artifactId':

The artifact ID is the project ID. Think of it as the ID assigned to the program being developed. In this example, enter SampleMavenApp.

Version

Define value for property 'version': 1.0-SNAPSHOT :

Specify the program version. The default is 1.0-SNAPSHOT, so leave it unchanged and press Enter or Return.

Package

Define value for property 'package': com.devkuma :

Specify the package where the program will be placed. The group ID is set as the default. If there is no problem, press Enter or Return as-is.

Confirm Input

Confirm properties configuration :
groupId : com.devkuma
artifactId : SampleMavenApp
version : 1.0-SNAPSHOT
package : com.devkuma
 Y :

The values entered so far are displayed. If there is no problem, press Enter or Return to create the project. If something is wrong, enter n and press Enter or Return to input the values again.

[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: /Users/kimkc/dev/mvn
[INFO] Parameter: package, Value: com.devkuma
[INFO] Parameter: groupId, Value: com.devkuma
[INFO] Parameter: artifactId, Value: SampleMavenApp
[INFO] Parameter: packageName, Value: com.devkuma
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /Users/kimkc/dev/mvn/SampleMavenApp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:05 min
[INFO] Finished at: 2017-12-11T22:56:34+09:00
[INFO] Final Memory: 11M/143M
[INFO] ------------------------------------------------------------------------