Using the maven versions plugin
./mvnw versions:update-parent
Problem: provides updates to alpha, beta, milestone, … and other non final versions. To avoid it, add following configuration:
pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<rulesUri>file:///${project.basedir}/maven-version-rules.xml</rulesUri>
</configuration>
</plugin>
maven-version-rules.xml
<ruleset comparisonMethod="maven"
xmlns="https://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 https://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<ignoreVersion type="regex">.*[-_\.](alpha|Alpha|ALPHA|b|beta|Beta|BETA|rc|RC|M|EA)[-_\.]?[0-9]*</ignoreVersion>
</ignoreVersions>
</ruleset>
Two options depending on how you define versions:
-
In each dependency: use the versions:use-* plugin goals.
-
In properties: use the versions:update-properties goal.
Don’t mix them and use the version:use-* plugins, it will replace any properties used in versions by the versions itself.
We are going to cover the properties based version update.
./mvnw versions:update-properties
In case there is a problem or you don’t want to migrate some dependencies:
pom.xml
<excludes>
<exclude>org.webjars:*</exclude>
</excludes>