how do i tell maven to get latest version of artifact from custom nexus repository

故事扮演 提交于 2020-02-24 19:43:26

问题


i have following requirement. i need to download the latest version of artifact from custom nexus repository rather than snapshot repository.

please suggest

Thanks.


回答1:


To get the latest version of any artifact, just omit the <version> tag from the dependency. This way maven will always fetch the latest version of this artifact from the remote repo.

Warning: Keep in mind that this is not the preferred way to handle dependencies nor it is the proper flow of dependency management. By keeping the version number open ended, there is a very high probability that your project may fetch a particular version of any library that is now not backward compatible and may break your functionality in the project. It is, therefore, always recommended to specify a particular version number of all artifacts that are required for any application and when updating any library version, one should properly test it.

EDIT

For maven3 you can use the facility of an open ended version tag. Something like this

<version>[1.12.4,)</version>

Take a look into this page for further details about version ranges




回答2:


According to this issue: https://issues.apache.org/jira/browse/MNG-3092 snapshots cannot be excluded (at least until this is fixed).



来源:https://stackoverflow.com/questions/23514208/how-do-i-tell-maven-to-get-latest-version-of-artifact-from-custom-nexus-reposito

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