Maven Notes
Maven 2 notes
Links
- Details on the settings.xml layout.
- Details on the pom.xml layout.
Create reference app
- To quick start a new project, use the archetype goal:
mvn archetype:create -DarchetypeArtifactId=maven-archetype-quickstart -DgroupId=ca.gordonturner -DartifactId=reference-app
- The -DarchetypeArtifactId= can used to specify differnt archetypes.
- The different archetypes are:
| Archetype | Description |
|---|---|
| maven-archetype-quickstart | The default value, a regular java project. |
| maven-archetype-webapp | A web application |
| maven-archetype-plugin | Maven plugin |
- For a complete list, see http://repo1.maven.org/maven2/org/apache/maven/archetypes/
- To setup multiproject project, see http://maven.apache.org/getting-started.html#Multiple_Modules
Release in mvn
- Check out from svn:
svn co http://svn.gordonturner.ca/example-app/trunk ./example-app
- Do a release:clean and release:prepare in batch mode:
mvn release:clean release:prepare --batch-mode
- Do a release:perform:
mvn release:perform
- Or do a deploy to a maven 1 repo, specifying all properties:
mvn deploy:deploy-file -Durl=file:///repo-directory -DuniqueVersion=false -DpomFile=./target/checkout/pom.xml -DrepositoryLayout=legacy -DrepositoryId=reference-app -Dfile=./target/reference-app-1.0.jar
Release requirements
- Edit your pom.xml to include
...
<scm>
<connection>scm:svn:http://svn.gordonturner.ca/example-app/trunk</connection>
<developerConnection>scm:svn:http://svn.gordonturner.ca/example-app/trunk</developerConnection>
</scm>
...
<distributionManagement>
<repository>
<id>maven2.gordonturner.ca</id>
<name>gordonturner.ca Maven2 Repository</name>
<url>scp://web.gordonturner.ca/gordonturner.ca/maven2</url>
<layout>default</layout>
</repository>
</distributionManagement>
...
- Your pom.xml <id> value must match the settings.xml <id>.
- Edit your $HOME/.m2/settings.xml to include:
...
<servers>
<server>
<id>maven2.gordonturner.ca</id>
<username>maven</username>
<password>Seekrit</password>
</server>
</servers>
...
- The <username> must have write access to the <url>scp://web.gordonturner.ca/gordonturner.ca/maven2</url> location.
Maven 1 notes
Links
- Details on the project.xml layout.
Multiproject buildpath eclipse
- To trick the maven eclipse into using dependent projects, add the maven.eclipse.classpath.include property to your project.properties and include a leading slash.
# Include all dependent projects # # (please include a leading slash) # maven.eclipse.classpath.include=/loyalty-core-source,/loyalty-core-tapestry