When I\'m running versions:display-dependency-updates
, it will show all the newest beta / milestone versions of my dependencies. I prefer using \"release\" packages
Two steps
Add rulesUri
to the plugin configuration
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<rulesUri>file:///${project.basedir}/rules.xml</rulesUri>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
Add the rules.xml
file to your project root directory.
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<!-- Ignore Alpha's, Beta's, release candidates and milestones -->
<ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*a(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*CR(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion>
</ignoreVersions>
<rules>
</rules>
</ruleset>
The regex filters out the unstable releases. You can also target rules for specific dependencies, see:
http://blog.xebia.com/keeping-dependencies-up-to-date-in-maven/
https://gist.github.com/seahrh/b13f4f3d618ad7c817038e0bc124ef29
Version rules will also stay for future releases of the plugin.
Maybe I misunderstand a thing but if I use mvn versions:display-dependency-updates
it will produce an output like this:
~/ws-git/test-project (two-module)$ mvn versions:display-dependency-updates
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Project : Parent
[INFO] Project : Mod-A
[INFO] Project : Mod-B
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Project : Parent 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:display-dependency-updates (default-cli) @ project-parent ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO] com.beust:jcommander .................................... 1.35 -> 1.55
[INFO] com.google.guava:guava ................................ 16.0.1 -> 19.0
[INFO] junit:junit ............................................. 4.11 -> 4.12
[INFO] log4j:log4j ............................. 1.2.16 -> 1.2.17-atlassian-1
[INFO] org.apache.logging.log4j:log4j-api ...................... 2.1 -> 2.6.1
[INFO] org.apache.logging.log4j:log4j-core ..................... 2.1 -> 2.6.1
[INFO] org.mockito:mockito-core ........................ 1.9.5 -> 2.0.78-beta
[INFO] org.testng:testng .................................... 6.8.8 -> 6.9.12
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Project : Mod-A 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:display-dependency-updates (default-cli) @ mod-a ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO] com.beust:jcommander .................................... 1.35 -> 1.55
[INFO] com.google.guava:guava ................................ 16.0.1 -> 19.0
[INFO] junit:junit ............................................. 4.11 -> 4.12
[INFO] log4j:log4j ............................. 1.2.16 -> 1.2.17-atlassian-1
[INFO] org.apache.logging.log4j:log4j-api ...................... 2.1 -> 2.6.1
[INFO] org.apache.logging.log4j:log4j-core ..................... 2.1 -> 2.6.1
[INFO] org.mockito:mockito-core ........................ 1.9.5 -> 2.0.78-beta
[INFO] org.testng:testng .................................... 6.8.8 -> 6.9.12
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Project : Mod-B 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:display-dependency-updates (default-cli) @ mod-b ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO] com.beust:jcommander .................................... 1.35 -> 1.55
[INFO] com.google.guava:guava ................................ 16.0.1 -> 19.0
[INFO] junit:junit ............................................. 4.11 -> 4.12
[INFO] log4j:log4j ............................. 1.2.16 -> 1.2.17-atlassian-1
[INFO] org.apache.logging.log4j:log4j-api ...................... 2.1 -> 2.6.1
[INFO] org.apache.logging.log4j:log4j-core ..................... 2.1 -> 2.6.1
[INFO] org.mockito:mockito-core ........................ 1.9.5 -> 2.0.78-beta
[INFO] org.testng:testng .................................... 6.8.8 -> 6.9.12
[INFO]
[INFO] No dependencies in Dependencies have newer versions.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Project : Parent ................................... SUCCESS [ 0.791 s]
[INFO] Project : Mod-A .................................... SUCCESS [ 0.046 s]
[INFO] Project : Mod-B .................................... SUCCESS [ 0.019 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.671 s
[INFO] Finished at: 2016-07-03T22:17:02+02:00
[INFO] Final Memory: 20M/439M
[INFO] ------------------------------------------------------------------------
where you can see things like junit:junit from 4.11 to 4.12 etc. Furthermore the questions is how the versions looks like of your dependencies etc. ?