

If a dependency on that artifact is required, you have the following options (other version ranges can be specified of course, just showing the relevant ones here):ĭeclare an exact version (will always resolve to 1.0.1): ĭeclare an explicit version (will always resolve to 1.0.1 unless a collision occurs, when Maven will select a matching version): 1.0.1ĭeclare a version range for all 1.x (will currently resolve to 1.1.1): [1.0.0,2.0.0)ĭeclare an open-ended version range (will resolve to 2.0.0): [1.0.0,)ĭeclare the version as LATEST (will resolve to 2.0.0) (removed from maven 3.x) LATESTĭeclare the version as RELEASE (will resolve to 1.1.1) (removed from maven 3.x): RELEASE

In the Maven repository, com.foo:my-foo has the following metadata: Here's an example illustrating the various options. A parenthesis ( ( & ) ) means "open" (exclusive).A square bracket ( ) means "closed" (inclusive).Or see this doc on Dependency Version Ranges, where: See the POM Syntax section of the Maven book for more details. Use LATEST and RELEASE with caution, if at all. When you release software, you should always make sure that your project depends on specific versions to reduce the chances of your build or your project being affected by a software release not under your control. If you are developing software, you might want to use RELEASE or LATEST as a convenience so that you don't have to update version numbers when a new release of a third-party library is released. In general, it is not a best practice to design software which depends on a non-specific version of an artifact.

RELEASE refers to the last non-snapshot release in the repository. LATEST refers to the latest released or snapshot version of a particular artifact, the most recently deployed artifact in a particular repository. When you depend on a plugin or a dependency, you can use the a version value of LATEST or RELEASE. You should use these options with care as you are no longer in control of the plugins/dependencies you are using. If you always want to use the newest version, Maven has two keywords you can use as an alternative to version ranges. (They still work perfectly fine for regular dependencies.)įor plugin dependencies please refer to this Maven 3 compliant solution. The mentioned LATEST and RELEASE metaversions have been dropped for plugin dependencies in Maven 3 "for the sake of reproducible builds", over 6 years ago.
