Ryan's Maven FAQ (Cheat Sheet):
Handy Links
Maven API Javadoc links to important classes
Compulsively executing mvn -U is a very good idea.
Since many of the components that a maven project depends on are resolved dynamically it is possible that you could be using very old plugins without realizing it at all. I was reading the we site for the archetype plugin and was attempting to use a goal that did not exist in a previous version of the plugin (archetype:generate).
Where do you find descriptions of the Maven pom elements?
Maven project descriptor reference
How do you exclude a specific test?
Add an excludes.exclude element to the surefire plugin configuration element. The element content may contain an ant-style path of an explicit test(s) from the default set of included tests.
This is specifically a question about the Maven Surefire Plugin and is answered here Inclusions and Exclusions of Tests.
Skipping all tests and executing a specific test is is answered in the official Maven FAQ.
How do you execute tests to support debugging?
This is a question about the Maven Surefire Plugin and is answered here Debugging Tests
How do you execute a single (or a select few) test(s)?
This is a question about the Maven Surefire Plugin and is answered here Running a Single Test
Here is an example of example of executing a single test with debugging support : mvnDebug test -DforkMode=none -Dtest=AgencyPlanDaoTest
What are the minimum changes needed to integrate cargo into a maven project?
Adding the following plugin element to the pom should be sufficient to configure the project to dynamically download and use tomcat. Cargo+Maven is nice because it will dynamically download the tomcat distribution from the specified url and execute the associated war using it as the Servlet container.
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.3-SNAPSHOT</version>
<configuration>
<container>
<containerId>tomcat5x</containerId>
<zipUrlInstaller>
<url>http://apache.mirrormax.net/tomcat/tomcat-5/v5.5.25/bin/apache-tomcat-5.5.25.zip</url>
</zipUrlInstaller>
</container>
</configuration>
</plugin>
How do you configure logging for a cargo project?
TODO
How do you configure cargo to launch the Servlet container for debugging?
Add a <cargo.jvmargs> element to to the plugin's <configuration><configuration><properties> element containing something like -agentlib:jdwp=transport=dt_socket,server=y,address=8000 as described here.
How do you use Maven archetypes?
The archetype plugin has undergone some significant changes in the recent versions.
The archetype:create goal has been deprecated in the latest version of the archetype plugin and replaced replaced with the archetype:create interactive plugin.
Using the Maven archetype plugin to interactively create a new project: mvn archetype:generate
Using the old style Maven archetype plugin to create a new jar: mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app This ends up using the later maven-archetype-quickstart archetype.
How do you specify the the Java source version?
How do I set up Maven so it will compile with a target and source JVM of my choice?
How do you locate a specific dependency coordinate in the maven repositories?
Best advice is to utilize http://mvnrepository.com/
How do you increase the memory available to the Maven JVM?
Maven itself will occasionally run out of resources and puke with an OutOfMemoryException. Increasing the maximum heap size using export MAVEN_OPTS=-Xmx512m (or another more sensible value). Note that this will only affect Maven itself. The Surefire plugin typically launches JUnit tests in a separate VM.
How do you find out what goals a plugin has?
?
How do you debug maven itself?
Instead of executing mvn use mvnDebug.
How do you find out what the default life cycle phases a plugin is bound to?
?