Developer

Creating Maven Projects

The main artifacts of a Maven project are the project object model (POM) file, and folders that contain source-code files.

Context

You can create a new Maven project on the command line, or in any IDE that supports Maven.

Procedure

To create a Maven project on the command line:
mvn archetype:create -DgroupId=com.sap.example -DartifactId=customState
where:
  • <groupId> – names the package.
  • <artifactId> – names the project and the project folder.
As the project is created, you see progress messages. For example:
[INFO] Scanning for projects...   
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/
maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/
maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom (5 KB at 6.8 KB/sec)       
[...]       
[INFO]   
[INFO]------------------------------------------------------------------------   
[INFO] Building Maven Stub Project (No POM) 1   
[INFO]------------------------------------------------------------------------   
[INFO]   
[INFO] --- maven-archetype-plugin:2.2:create (default-cli) @ standalone-pom ---   
[...]
[INFO]------------------------------------------------------------------------   
[INFO] BUILD SUCCESS   
[INFO]------------------------------------------------------------------------   
[INFO] Total time: 41.155s   
[INFO] Finished at: Mon Oct 22 17:00:49 PDT 2012   
[INFO] Final Memory: 8M/245M