Also see MavenRepositoryFAQ
How can I create a report of a project's dependencies?
This will generate an html report (dependencies.html) in the project target/site directory.
Is there a tool to analyze dependencies for a project?
The dependency plugin has some features that can help with managing dependencies.
This will check the dependency tree for unused dependencies and dependencies that are being used but are not listed in the pom.
mvn dependency:tree -Dverbose=true
This will print out the entire dependency tree (not including stuff used only by plugins).
How can I get the sources for dependencies into my local repository?
This Goal resolves the project source dependencies from the repository.
For more info see,
How can I skip the test suite or run a single test?
mvn -Dmaven.test.skip.exec=true <goal>
mvn -Dtest=org/jboss/someTestCase test
More information can be found in the documentation for the maven surefire plugin
Maven is not finding the correct dependencies and/or plugins. What can I do?
mvn -U -up
The -U updates dependecies, the -up updates plugins.
How can I see the effective pom (project pom combined with parents)?
The maven help plugin can be used to show what the pom will look like after the parent is resolved.
If I need to go offline (on plane, etc) how can I make sure my project has all the dependencies needed to build locally?
mvn dependency:go-offline -Dmaven.repo.local=/mypath/repository.jboss.org/maven2
This will download all your projects dependencies to your local repository in the location specified.
If you might be changing the project's dependencies, and you are not sure which files you will need, you can check out the jboss repository via svn (http://anonsvn.jboss.org/repos/repository.jboss.org) and/or you can rsync the whole central maven repository (rsync -v -t -l -r mirrors.ibiblio.org::maven2 /your/local/path).
How can I copy my project's dependencies from the central maven repository to the jboss repository?
First you will need a local checkout of the jboss maven repository:
svn co https://svn.jboss.org/repos/repository.jboss.org/maven2 /home/me/repository.jboss.org/maven2
This may take a while, so be patient. Note: this process may be changed to use a dedicated third party repository at a later time.
Next download your project's dependencies into the local repository checkout. The "-U -up tells maven to update dependencies and plugins:
mvn -U -up dependency:go-offline -Dmaven.repo.local=/home/me/repository.jboss.org/maven2
Last step is to commit the files you have downloaded to the repository. After a short delay (about 5 min) the new files will be available on the repository web site.
How can I generate a report of a build's test results?
The surefire report plugin can be used like this:
If you want the report to only show failures:
mvn -DshowSuccess=false surefire-report:report
How can I depend on an assembly artifact?
To depend on an assembly artifact such as an spi artifact, use the classifier element to specify the assembly/id value as the dependency classifier. For example, given an assembly descriptor like:
<assembly> <id>profileservice-spi</id> <formats> <format>jar</format> </formats> ...
The dependency on the jboss-as-system-x.y.z-profileservice-spi.jar would be:
<dependency> <groupId>org.jboss.jbossas</groupId> <artifactId>jboss-as-system</artifactId> <classifier>profileservice-spi</classifier> <version>x.y.x</version> </dependency>
How can I tell maven to use a particular snapshot version of a dependency?
Normally maven grabs the latest build when a snapshot dependency is specified. If you want to lock down on a particular version, you can specify the timestamp-buildNumber in your dependency version. So for example, to use build number 3 of jboss-test version 1.0.4-SNAPSHOT, your dependency would look like this:
<dependency> <groupId>jboss</groupId> <artifactId>jboss-test</artifactId> <version>1.0.4-20070411.162854-3</version> </dependency>
How can I prevent certain transitive dependencies from getting picked up?
For example, an old artifact that has been renamed might be picked up transitively because maven doesn't know that the newer renamed version is the same artifact. The maven enforcer plugin can be used to prevent certain dependencies.