Development Environment Setup
This guide explains how to use Maven in Eclipse, IDEA and NetBeans.
Eclipse
using maven integration plugin for eclipse
This will not work for older Eclipse versions (pre 3.4 Ganymede).
Install the eclipse-plugin 'Eclipse Maven Integration' from update site http://m2eclipse.codehaus.org/update/.
Check out itracker from SVN, usually trunk-version.
Import the checked out project using maven import-wizzard: File > Import ... > General > Maven Projects
More information: http://m2eclipse.codehaus.org/
maven generated (old path)
To generate the Eclipse project files from your POM execute the following command: mvn eclipse:eclipse -DdownloadJavadoc=true -DdownloadSources=true
This command will create the necessary files for Eclipse development. Including jar dependencies as defined in the POM. For first time opening of the project it has to be imported into the workspace. On the menu bar: select File -> Import -> Existing Projects into Workspace. On succeeding executions of this command no need to import the project, just do a refresh.
Note: The workspace location should not the same as in the project location as Eclipse won't function properly.
Eclipse doesn't automatically know the location of the project jar dependencies. Several errors are displayed on the Problems tab - Unbounded classpath variable. To resolve this the M2_REPO classpath variable has to be defined.
On the menu bar: select Window -> Preferences. Select Java -> Build Path -> Classpath Variables page. Click on the New button. Specify M2_REPO in the name field and specify the path to the maven repository in the path field. On windows machine this is usually in C:/Documents and Settings/username/.m2. On *nix machine this is on ~/.m2.
Existing Projects into Workspace). In the latter case the project (directory) should not be located in your workspace, because Eclipse might come into trouble, especially if you want to use Eclipse as the scm client.
IDEA
mvn idea:idea -DdownloadJavadoc=true -DdownloadSources=true
NetBeans
TODO
Tomcat
To deploy/undeploy application you can use Tomcat Maven Plugin. It provides goals to manipulate WAR projects within the Tomcat servlet container.
The most interesting are:
mvn -Dmaven.test.skip=true clean tomcat:deploy deploy application without tests
mvn tomcat:undeploy undeploy application. More information: http://mojo.codehaus.org/tomcat-maven-plugin/index.html
For application debug you can use RemoteDebug mode.\
It is useful to install antiJARLocking="true" property in context.xml to avoid JAR file locking
If true, the Tomcat classloader will take extra measures to avoid JAR file locking when resources are accessed inside JARs through URLs. This will impact startup time of applications, but could prove to be useful on platforms or configurations where file locking can occur. If not specified, the default value is false.
More information: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html