Maven独特的快照和依赖收敛
我有一个项目,其中 maven-enforcer 规则因使用非唯一快照(令人烦恼的是 Maven 3 中唯一支持的快照类型)的多模块构建而失败。
例如,假设->是“依赖于”关系,并且:
- Module-A -> Module-A模块-B ->模块-C
- 模块-A ->模块 C
以及模块 B 和模块 C 作为唯一构建存在于快照存储库中。 POM 中声明的所有模块版本当前均为 1.0-SNAPSHOT。
现在,构建模块 A 失败:
mvn -pl Module-A install
导致:
[INFO] --- maven-enforcer-plugin:1.0.1:enforce (enforce) @ Module-A ---
[ERROR]
Dependency convergence error for com.vivosys.project:Module-C:1.0-SNAPSHOT paths to dependency are:
+-com.vivosys.project:Module-A:1.0-SNAPSHOT
+-com.vivosys.project:Module-B:1.0-20111228.032527-8
+-com.vivosys.project:Module-C:1.0-SNAPSHOT
and
+-com.vivosys.project:Module-A:1.0-SNAPSHOT
+-com.vivosys.project:Module-C:1.0-20111228.032527-6
传递依赖项被解析为非唯一快照构建,但直接依赖项被解析为唯一快照构建。
我使用的是maven 3.0.3,maven-enforcer 1.0.1。存储库是 Artifactory 2.4.2,使用唯一快照选项(按照 Artifactory 的建议,因为 Maven 3 不再支持非唯一快照)。
解决方案?
更新:看起来artifactory允许覆盖maven客户端行为并将非唯一快照存储在存储库中。然而,出于某种原因,Artifactory 不建议这样做(请参阅 处的“Maven 3”简介) http://wiki.jfrog.org/confluence/display/RTF/Local+Repositories),因此仍然欢迎其他解决方案。
I have a project in which the maven-enforcer rule fails with a multi-module build using non-unique snapshots (which are annoyingly the only kind of snapshot supported in Maven 3).
For example, assume -> is a "depends on" relationship, and:
- Module-A -> Module-B -> Module-C
- Module-A -> Module-C
and that Module B and Module C are present in the snapshot repository as unique builds. All declared Module versions in the POM are currently 1.0-SNAPSHOT.
Now, building Module A fails:
mvn -pl Module-A install
results in:
[INFO] --- maven-enforcer-plugin:1.0.1:enforce (enforce) @ Module-A ---
[ERROR]
Dependency convergence error for com.vivosys.project:Module-C:1.0-SNAPSHOT paths to dependency are:
+-com.vivosys.project:Module-A:1.0-SNAPSHOT
+-com.vivosys.project:Module-B:1.0-20111228.032527-8
+-com.vivosys.project:Module-C:1.0-SNAPSHOT
and
+-com.vivosys.project:Module-A:1.0-SNAPSHOT
+-com.vivosys.project:Module-C:1.0-20111228.032527-6
The transitive dependency is resolved as a non-unique snapshot build, but the direct dependency is resolved as a unique snapshot build.
I am using maven 3.0.3, maven-enforcer 1.0.1. The repository is Artifactory 2.4.2 using the unique snapshots option (as recommended by Artifactory since Maven 3 no longer supports non-unique snapshots).
Solutions?
Update: Looks like artifactory allows overriding the maven client behavior and storing the non-unique snapshot in the repository. However, for some reason Artifactory does not recommend this (see the "Maven 3" blurb at http://wiki.jfrog.org/confluence/display/RTF/Local+Repositories) so other solutions are still welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此错误已修复 (MENFORCER-118) 和 在版本 1.1 中发布 。
This bug has been fixed (MENFORCER-118) and released in version 1.1.
您遇到了此强制插件错误(作为增强功能提出)。
也许,严格地作为一种解决方法,您可以显式地将传递依赖项 C 声明为 A 的依赖项?
You have hit this enforcer plugin bug (raised as enhancement).
Perhaps, strictly as a workaround you can explicitly declare the transitive dependency C as a dependency of A?
在解决 MENFORCER-118 之前唯一可用的解决方案似乎是将存储库服务器配置为使用非唯一快照。在 Artifactory 中,这可以通过以下方式完成:
管理、存储库
,选择快照存储库并选择编辑
。然后选择Maven 快照版本行为
下的Nonunique
。The only solution available until MENFORCER-118 is resolved appears to be to configure the repository server to use non-unique snaphots. In Artifactory, this can be done via:
Admin, Repositories
, select the snapshot repository and chooseEdit
. Then selectNonunique
underMaven Snapshot Version Behavior
.