Maven Version Range - downloads all the available versions not just the latest one

隐身守侯 提交于 2019-12-25 09:12:58

问题


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)


回答1:


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...



来源:https://stackoverflow.com/questions/45261222/maven-version-range-downloads-all-the-available-versions-not-just-the-latest-o

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!