Sunday, January 16, 2011

Getting started with Maven

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

Download and extract bin from http://maven.apache.org/download.html

Basics:
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

To install a package into your local repository:
1) Open <MAVEN_HOME>/conf/settings.xml
2) Set the local repository
<localRepository>S:/bel/repo</localRepository>
3) Set profile
4) Set what profile to activate
5) Set proxy (optional?)
6) Run mvn install (if variables are needed, add -D{varname}={varValue}). To skip test add <skipTests>true</skipTests> on pom.xml (inside properties tag). To set a default/permanent variable, set it in MAVEN_OPTS environment variable

How to set MAVEN_OPTS
-> set MAVEN_OPTS=-Xmx512M -XX:MaxPermSize=128M
-> add in mvn.bat
1) edit <MAVEN_HOME>/bin/mvn.bat
2) add SET MAVEN_OPTS=-Dmaven.test.skip=true

Note:
- dependencies -> mvn install copies all libraries first from WEB-INF/lib to the snapshot lib before downloading all dependencies declared in pom into the snapshot lib. so make sure to always clean up WEB-INF/lib first before executing mvn install to remove any conflicting jars

Source: http://maven.apache.org/

No comments:

Post a Comment