2

Using the following versioning logic

major.minor.build

is there any way to specify that my project depends on a specific major version, the highest minor and the lowest build number?

I need to do this because I'm using the maven-dependency-plugin to copy all the dependencies of our multiple WAR files into a common folder, so that it can be sent to the client the latest version, but at the same time keep the numbers of packages to a minimum.

Community
  • 1
  • 1
Gonçalo Cardoso
  • 2,253
  • 4
  • 34
  • 63

1 Answers1

1

No, it is not possible. When Maven encounters multiple matches for a version reference, it uses the highest matching version. Here you can find good explanation how to work with version ranges in maven.

I can suggest other solution for your original task:

  1. Create new maven module.
  2. Add all projects that you need as a dependencies to this module.
  3. Use maven-dependency-plugin to copy dependencies of this module.

Maven guarantees that one and only one version of each (groupId:artifactId) is used. You can check resolved versions using mvn dependency:tree.

Kostiantyn
  • 935
  • 8
  • 13