maven snapshot repositories

醉酒当歌 提交于 2020-01-06 07:09:32

问题


My project depends on a 3rd party library that only has snapshots in its maven repository (no releases, which seems strange, but that's how it is). Every time I do a full build (and clean my local .m2 repository) maven will obviously go and grab the latest build.

My repository proxies the one with the snapshots in it, is there anyway to tell my repository to stop pulling new versions and basically just keep the current version? I really don't want to be pulling a new build every night.

The only thought I had is to manually label the current versions, but there quite a few dependencies and they are all dependent on the SNAPSHOT versions. Is there an easier way to do this?

thanks,

Jeff


回答1:


Take a look at this blog entry from sonatype: Best Practices for 3rd Party Snapshot Dependencies

I usually install the file to my proxy or local repo as a certain version, and then refer to that version. Then you don't risk the snapshot disappearing out from under you.




回答2:


Do you run the build with the -U ( -update-snapshots ) option ? If so, try without.

Else, if there is only this dependency on the repository, you could just disable this repository, and Maven will keep using the last version it finds on the local repository.




回答3:


Did you try to specify the <updatePolicy> with the never strategy in the <snapshots> element of your <pluginRepository>? See Plugin Repositories and Repositories.




回答4:


Use the --no-snapshot-updates option to suppress SNAPSHOT updates.

e.g.

$ mvn --no-snapshot-updates compile


来源:https://stackoverflow.com/questions/1683159/maven-snapshot-repositories

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