Keeping your dependencies up-to-date is more important than ever in modern projects. Everything is connected to the internet and needs to be secure. New vulnerabilities in libraries are found, exploited and patched within days. We use a lot of dependencies, and due to continuous delivery some of your dependencies will need updating every day. Solid dependency management is a primary requirement for good software.

In this blog post I will describe how to keep a Maven project up-to-date with the versions plugin. Using the versions plugin has a lot of benefits and configuring it takes less than an hour. So I suggest using it for all maven projects.

The maven goal that achieves this is:

[bash light=”true”]
mvn versions:display-dependency-updates

By default, it will generate a list on the command prompt of all your outdated dependencies. But it will contain false positives and to use it in a continuous integration environment, more configuration is required.

This example assumes a typical maven project, with a parent pom that configures all dependencies using the maven dependency management mechanism. The plugin configuration I used is:


Here the <outputFile> contains the file where the results are written to. <inherited>false</inherited> stops the plugin from running on your child projects. If all your dependencies are defined in the parent pom this will only clutter the results.
The most interesting setting is the <rulesUri> tag. This tag refers to a file where you can make rules defining what is considered an update.
Sometimes the versions plugin suggests a dependency update that you do not want. Most projects only use stable libraries, and avoid various Alpha, Beta, Release Candidate and Milestone versions. There are also several odd version numbers out there, which mess up the plugin. For example, commons-collections has a version number 20031027.000000, released in 2005. You probably want version 3.2.2, released in 2015. However, the plugin will suggest 20031027.000000, because 20031027 is bigger than 3.
Finally, sometimes you do not want to update a dependency because of an incompatible API or because it is not worth the effort to upgrade.

To accommodate this, you need comparison rules. These are described in an XML file and tell the plugin what versions to pick. You can find the description here:

For our project I used the following file:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="" xmlns:xsi="" comparisonMethod="maven" xsi:schemaLocation="">
<!– Ignore Alpha’s, Beta’s, release candidates and milestones –>
<ignoreVersion type="regex">(?i).*Alpha(?:-?\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>
<!– Obvious mismatches –>
<rule groupId="commons-collections" artifactId="commons-collections">
<ignoreVersion type="regex">^200.*$</ignoreVersion>
<rule groupId="commons-logging" artifactId="commons-logging">
<rule groupId="org.hamcrest">
<!– Version 5 of hibernate requires javax.validation 1.1.0. This is a new api and a lot of effort to upgrade –>
<rule groupId="org.hibernate" artifactId="hibernate-validator" comparisonMethod="maven">
<ignoreVersion type="regex">^5.*$</ignoreVersion>
<rule groupId="javax.validation" artifactId="validation-api">
<ignoreVersion type="regex">1.1.0.Final</ignoreVersion>

As you can see, I commented the choices I made when selecting versions:
I threw out all non-stable releases. I solved some odd versioning in commons-collections and commons-logging. I ignored the Atlassian specific version of Hamcrest. I also disabled Hibernate 5, because 4 works fine for us and we do not want to use the new API.

Note that this file is a very good place to document these dependency decisions.

You can now setup Jenkins to run this regularly (we run it once every Sunday) and mail the generated file outdated-dependencies.txt. This will make it easy to keep your projects up-to-date. Feel free to use our rules file as a starting point for your project.

Do you want to know more about this subject?
Look at our consultancy services, training offers and careers below or contact us at