Fork me on GitHub


What does the Versions Maven Plugin do?

The Versions Maven Plugin provides a means to update version information in a Maven project


Why is this plugin reporting version of foo:bar as the latest version when I can see version

The current implementation of DefaultArtifactVersion in the core of Maven expects that version numbers will have a very specific format:

MajorVersion [ . MinorVersion [ . IncrementalVersion ] ] [ - BuildNumber | Qualifier ]

WhereMajorVersion,MinorVersion,IncrementalVersion, and BuildNumber are all numeric and Qualifier is a string. If your version number does not match this format, then the entire version number is treated as being theQualifier.

Version numbers in maven are compared using the individual components, soMajorVersion, MinorVersion,IncrementalVersion, and BuildNumber are all compared asIntegers while Qualifier is compared as aString.

From the above you may have guessed neither nor match the exact format that Maven expects, and as a result they are mapped as being just aQualifier. String comparison will sort >

If you need version numbers to be sorted "correctly" you will need to define some version number comparison rules .


Why is foo:bar version x.y.z not being detected?

In order to determine what versions of an artifact are present, Maven relies on the presence of meta-data files in the repository. If the meta-data files are missing or contain invalid information then Maven will not know about versions that are available in your repositories.

Here are some common reasons why your metadata can be invalid:

  • You are using a local repository as a remote repository. Stop, don't do this. The local repository uses a separate set of metadata files from those used by a remote repository. There are tools available to convert a local repository into a remote repository, but you're really better off using a repository manager.
  • Artifacts have been deployed by non-maven metadata aware tools.
  • Tools that claim to be maven meta-data aware have clobbered the metadata files.

In most cases, using a repository manager will solve these issues as the repository managers usually rebuild the metadata files based on the artifacts that are present.