Updating Maven Project Dependencies

  • Post author:
  • Post category:Tools

Using the Maven Versions plugin, you can easily update your Maven dependencies to use newer versions. Most will be using properties to specify dependency versions, so we will be assuming that in this blog post. If you are not using properties, look at the <i>versions:display-dependency-updates<i> command instead.

1. Run <i>display-property-updates</i> to display dependencies with newer versions.

> mvn versions:display-property-updates

2. You can manually update the versions you want from here. If you want to apply all the newer versions, you can run <i>versions:update-properties</i>, which modifies your pom.xml and updates the versions for you.

> mvn versions:update-properties

3. Running <i>versions:update-properties</i> creates a backup of your pom.xml. If the changes look good, you can remove this backup manually or you can run the following command.

> mvn versions:commit