Repository Management with Nexus

20.2. Creating a New Maven Project

In this chapter, you will be creating a simple Maven project with a simple website that will be published to a Nexus Site repository. To create a new Maven project, use the archetype plugin’s archetype:generate goal on the command line, and supply the following identifiers:

  • groupId: org.sonatype.books.nexus
  • artifactId: sample-site
  • version: 1.0-SNAPSHOT
  • package: org.sonatype.books.nexus
~/examples$ mvn archetype:generate
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
Choose archetype:
1: internal -> appfuse-basic-jsf
...
13: internal -> maven-archetype-portlet (A simple portlet application)
14: internal -> maven-archetype-profiles ()
15: internal -> maven-archetype-quickstart ()
...
Choose a number:  (...14/15/16...) 15: : 15
Define value for groupId: : org.sonatype.books.nexus
Define value for artifactId: : sample-site
Define value for version:  1.0-SNAPSHOT: : 1.0-SNAPSHOT
Define value for package:  org.sonatype.books.nexus: : org.sonatype.books.nexus
Confirm properties configuration:
groupId: org.sonatype.books.nexus
artifactId: sample-site
version: 1.0-SNAPSHOT
package: org.sonatype.books.nexus
Y: :
[INFO] Parameter: groupId, Value: org.sonatype.books.nexus
[INFO] Parameter: packageName, Value: org.sonatype.books.nexus
[INFO] Parameter: package, Value: org.sonatype.books.nexus
[INFO] Parameter: artifactId, Value: sample-site
[INFO] Parameter: basedir, Value: /private/tmp
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] OldArchetype created in dir: /private/tmp/sample-site
[INFO] -------------------------------------------------------------
[INFO] BUILD SUCCESSFUL

After running the archetype:generate command, you will have a new project in a sample-site/ subdirectory.