Search code examples
mavenpom.xmldependency-managementmaven-centralversions-maven-plugin

Not seeing latest dependency version when I run versions:display-dependency-updates


I am trying to update dependencies in my java mvn project to latest version. When I run below command I see latest versions displayed, but I see different versions in central repository.

mvn versions:display-dependency-updates -DskipTests=true --update-snapshots install

For example, when I ran above command I got this for commons-collections

commons-collections:commons-collections ............ 3.2.1 -> 20040616

But when I browse it in the central repository - commons-collections:MVN Repo, I see many updates after 20040616

Can someone clarify which is the latest version and MVN command to get the latest?


Solution

  • The display-dependency-updates command assumes that versions are numbered according to a very specific <Major>.<Minor>.<Incremental>-<Qualifier> structure, per the versions-maven-plugin Version Number Rules. It determines "newest" by sorting according to those criteria, and not via some sort of timestamp. When using dependencies that follow different rules, it's not likely to be able to tell you which version is actually newer. Sadly, this makes display-dependency-updates not nearly as useful as one might hope, but I still find it useful as a starting point to check and see what dependencies may need to be updated.