Maven Version Range - downloads all the available

2019-08-19 07:24发布

I have two modules: A and B. A depends from B.

In the module A there is a dependency to B with the following version setting: [1.0.0,)

From the B there are two versions: 1.0.0-1 and 1.0.0-2. The 1.0.0-1 is out of date, it has some missing dependencies, hence I cannot create a build from it. But the 1.0.0-2 is working fine.

When I use the install for the module A I get an error that B:1.0.0-1 has a missing dependency.

That's happening because the maven downloaded all the versions from the 1.0.0 not just the last one.

If I would use LATEST then just the 1.0.0-2 would be downloaded, but it's not what I want. Basically I would like to download just the latest from the 1.0.0.

How could I do this ?

Thank you for the answers!

(Maven version: 3.5.0)

标签: maven maven-3
1条回答
看我几分像从前
2楼-- · 2019-08-19 08:23

First don't use versions ranges cause they make your build non reproducible.. If you like to update things like that you can use versions-maven-plugin to update the dependency. Apart from that what is the difference between 1.0.0-1 and 1.0.0-2..From your explanations i would assume you should change your versions schema cause the second one is not compatible with the first one so I would say 2.0.0 instead of 1.0.0-2..or is see it as a bug fix than 1.0.1...(following semver). Another point LATEST is marked deprecated for a long time and will produce a WARNING in the next Maven versions..

Coming to you explanations: I have my doubts that all artifacts are being downloaded...If you take a look at the logging output I assume there are some line saying ...maven-metadata.xml will be downloaded...

First part of the answer...

查看更多
登录 后发表回答