'Using maven dependency management import scope with version ranges

We are trying to centralize the versions of all the artifacts that we are using in our code base to remove duplication and ease the task of bumping versions.

We have created a BOM pom with the versions of all of our artifacts and third party artifacts and imported it (scope import) in the dependencyManagement section of the poms of each of our artifacts.

To avoid having to update each artifact each time the bom version changes we have tried to use a version range when importing the bom.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.acme</groupId>
      <artifactId>bom</artifactId>
      <version>[1.0,)</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

However maven does not seem to recognize version ranges in the dependencyManagement section of a pom.

I'm aware that if the relationship between our artifacts were hierarchical we could use modules and release from a parent POM. However unfortunately this is not the case.

This must be a common use case for maven. What are we doing wrong or what other solutions exist?



Solution 1:[1]

Taking into account the number of relevant issues in Maven issues tracker, it looks like it was a long-lasting issue in Maven.

Based on the most recent and relevant ticket, this will be resolved in the next major Maven release (4.0.0).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1