Maven2

From CodeMonkeyWiki

Jump to: navigation, search

Creating a new Java project

mvn archetype:create \
 -DgroupId=company_name \
 -DartifactId=project_name \
 -DarchetypeArtifactId=maven-archetype-archetype 

This will create a basic java project structure and a maven pom.xml. The projects package name will be company_name.project_name.

Creating a new Struts2 webapp project

mvn archetype:create \
 -DgroupId=company_name \
 -DartifactId=project_name \
 -DarchetypeGroupId=org.apache.struts \
 -DarchetypeArtifactId=struts2-archetype-starter

This will create a struts2 portlet webbapp project structure and a maven pom.xml. The java part of the project package name will be company_name.project_name.

Installing a jar into local repository

This will also generate a pom and checksum

mvn install:install-file \
  -Dfile=file_location.jar \
  -DgroupId=group_id \
  -DartifactId=artifact_id \
  -Dversion=version \
  -Dpackaging=jar \
  -DgeneratePom=true \
  -DcreateChecksum=true
Personal tools