maven如何决定引用最新的artifact信息
我们使用 mvn deploy:deplo
y 将工件部署到存储库管理器,开发人员只需对同一工件执行 mvn install
即可,因此该工件出现在 M2_HOME\.m2\repository
如果更新比本地存储库副本最近,maven 运行时是否会从存储库管理器中检索工件?
注意:我们使用基于 Apache Archiva 的 Maven 存储库管理器。
We use mvn deploy:deplo
y to deploy an artifact to repository manager and a developer could have done just mvn install
for the same artifact, so the artifact is present under M2_HOME\.m2\repository
Will the maven runtime retrieve the artifact from the repository manager if it was updated recently than the local repository copy?
Note: We use a maven repository manager based on Apache Archiva.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案取决于您谈论的是快照还是发布版本。
发布版本有一个不以“-SNAPSHOT”结尾的版本,并且它们是最终的且不可变的。一旦安装到任何存储库,Maven 将永远不会更新它们。对于您的问题,这意味着如果开发人员在本地安装发布版本,则永远不会从任何远程存储库更新它。
快照版本始终可以从任何存储库进行更新。默认情况下,Maven 每天检查一次新快照版本,因此如果有人在本地安装快照,该快照将一直存在,直到 Maven 下次检查快照更新为止。然后,如果它检查的任何远程存储库中有较新的版本,则本地版本将被覆盖。您可以使用
-U
命令行选项强制 Maven 更新快照工件。The answer depends on whether you're talking about a snapshot or a release build.
Release builds have a version that doesn't end with "-SNAPSHOT", and they're final and immutable. Once installed to any repository, Maven will never update them. To your question, that means that if a dev installs a release build locally, it will never be updated from any remote repository.
Snapshot builds are always eligible to be updated from any repository. By default, Maven checks once per day for new snapshot versions, so if someone installs a snapshot locally, that snapshot will exist until Maven does its next check for snapshot updates. Then, if a newer version is in any remote repository it checks, the local one will be overwritten. You can force maven to update snapshot artifacts with the
-U
command line option.