我有以下听起来很疯狂的问题。我有一个项目 A,它使用使用 Lib C 的 Lib B。Lib C 不在中心。Lib B 有一个父级,它定义了一个可以在其中找到 lib C 的存储库。取决于 mvn 版本,也许还有其他一些香料,它是否有效。该项目的问题是 MoSKito:https ://github.com/anotheria/moskito 。MoSKito 依赖于 xchart (com.xeiam.xchart:xchart 2.5.0)。xchart 使用 VectorGraphics2D (de.erichseifert.vectorgraphics2d:VectorGraphics2d:0.9.1)。VectorGraphics2D 不在中心。
xchart 在其父级 (com/xeiam/xchart/xchart-parent/2.5.0/xchart-parent-2.5.0.pom) 中定义了 VectorGraphics2D 的依赖关系:
<repositories>
<repository>
<id>erichseifert.de</id>
<url>http://mvn.erichseifert.de/maven2</url>
</repository>
</repositories>
现在回到原来的问题:当我在我的机器上构建 MoSKito 时, VectorGraphics2D 是从http://mvn.erichseifert.de/maven2下载的。我在我的构建日志中看到它,它也存在于存储库中,文件 _remote.repositories 包含以下内容:
#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Wed Oct 28 16:18:30 CET 2015
VectorGraphics2D-0.9.1.jar>erichseifert.de=
VectorGraphics2D-0.9.1.pom>erichseifert.de=
如果其他人构建 MoSKito,则不会下载文件并且错误消息是
[ERROR] Failed to execute goal on project moskito-webui: Could not resolve
dependencies for project net.anotheria:moskito-webui:jar:2.6.4-SNAPSHOT: Failure
to find de.erichseifert.vectorgraphics2d:VectorGraphics2D:jar:0.9.1 in
http://nexus.locale/nexus/content/groups/provided was cached in the local
repository, resolution will not be reattempted until the update interval of nexus
has elapsed or updates are forced -> [Help 1]
是否可以进行任何设置来解决此问题,所以它至少是确定性的?
PS谁将此问题标记为maven force update dependencies question的重复,它与依赖项更新无关。它是关于 maven 从引用项目中指定的存储库中解析工件。有时它有效,有时则无效。