Maven 使用相同版本的新文件进行更新
我正在使用 Maven,但有一个问题 - 如果我的同事更新 jar 文件 - Maven 不会更新它。所以我必须转到 .m2/repository 并手动删除它。在此 Maven 更新依赖 jar 后正确。 但可能存在另一种方式来调整,而不需要每次都手动删除? 谢谢。
I am using Maven and have a problem - if my colleague update jar file - Maven doesn't update it. So I have go to .m2/repository and manually delete it. After this Maven update dependance jar correct.
But may be exists another way to adjust, without each time delete manually?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您应该确保您同事的工件以快照版本号发布,只要它尚未稳定(请参阅 http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-syntax.html#pom-relationships-sect-snapshot-versions) 。这将导致 Maven 定期检查更新。
要指定检查发生的频率,您可以修改同事部署到的存储库的
updatePolicy
(请参阅First, you should make sure that your colleague's artifact is released with a SNAPSHOT version number as long as it it is not yet stable (see http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-syntax.html#pom-relationships-sect-snapshot-versions). This will cause Maven to check for updates regularily.
To specify how often the check occurs, you can modify the
updatePolicy
of the repository to which your colleague deploys (see http://maven.apache.org/settings.html#Repositories). You can set it toalways
to make Maven pull snapshot updates as soon as your colleague deploys them.您还可以将 -U 添加到 mvn 命令中,以强制 maven 检查存储库是否有更新(mvn clean install -U),但就像 dosendoc 所说,首先确保您正在使用 SNAPSHOT 版本。
You can also add -U to the mvn command to force maven to check the repository for updates (mvn clean install -U) but like dosendoc said first make sure you're working off SNAPSHOT versions.