Simple & Useful Maven commands

This is a collection of useful maven commands that is updated if I find something useful, that is worth mentioning 😎

Advance child versions

If you’ve got a multi-module project and want to update the project version in all modules, then just update it first in the main pom.xml.

<!-- before --> <version>1.2.0</version
<!-- after  --> <version>1.2.1-SNAPSHOT</version>

After updating the main pom.xml you can let maven rewrite the rest:

mvn -N versions:update-child-modules

You can read the original maven documentation for the plugin here

Batch-Release with a different Git-Repository

This is useful if you have to build a release using the maven-release-plugin without connection to the real repository defined in the pom.xml. This is useful for building release completely offline.

mvn release:prepare "-Dproject.scm.developerConnection=https://host/your-repo.git" "-Dproject.scm.connection=https://host/your-repo.git" "--batch-mode" "-DreleaseVersion=1.3.1" "-DdevelopmentVersion=1.3.2-SNAPSHOT" "-DautoVersionSubmodules=true" "-DpushChanges=false"

After this, you can also release to a local maven repository with this (this time I’m not overriding the repository):

mvn release:perform "-DlocalCheckout=true"

Beitrag veröffentlicht

in

, , ,

von

Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert