Maven snippets

February 26, 2013 by Michael

This post will contain some Maven snippets that i use and forget regularly (similar to my Git Post).

Download the sources of all dependencies of a project if available:

mvn dependency:sources

Download the JavaDoc for all dependencies if available:

mvn dependency:resolve -Dclassifier=javadoc -Dtype=jar

Check for updates of all direct dependencies:

mvn versions:display-dependency-updates

Skip signing of artifacts (i.e. for a local install of a snapshot)

mvn -Dgpg.skip=true install

If you need to branch from a tag and fix some bugs, i recommend to checkout the tag and then use

mvn release:branch -DbranchName=my-branch -DupdateBranchVersions=true -DupdateWorkingCopyVersions=false

This creates a new branch “my-branch” and updates the version to x.x.x-SNAPSHOT in the branch and leaves the working copy as is.

Run single tests or single methods in tests: Nice, official documentation right here

If you want to run single (integration) tests but the build fails because you didn’t run unit tests, add

-DfailIfNoTests=false

Execute a goal of a single, configured plugin with a given execution id:

mvn asciidoctor:process-asciidoc@generate-docs

List goals by the order they will execute

mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list

Group goals by phase

mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list-phase

Group goals by plugin

mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list-plugin

Last update: 2018/01/09

No comments yet

Post a Comment

Your email is never published. We need your name and email address only for verifying a legitimate comment. For more information, a copy of your saved data or a request to delete any data under this address, please send a short notice to michael@simons.ac from the address you used to comment on this entry.
By entering and submitting a comment, wether with or without name or email address, you'll agree that all data you have entered including your IP address will be checked and stored for a limited time by Automattic Inc., 60 29th Street #343, San Francisco, CA 94110-4929, USA. only for the purpose of avoiding spam. You can deny further storage of your data by sending an email to support@wordpress.com, with subject “Deletion of Data stored by Akismet”.
Required fields are marked *