maven无法从传递存储库中获取依赖关系(有时)

时间:2015-10-28 16:39:24

标签: java maven

我有以下问题听起来很疯狂。我有一个项目A,它使用Lib B,它使用Lib C. 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已在其父级中定义了VectorGraphics2D的依赖项(com / xeiam / xchart / xchart-parent / 2.5.0 / xchart-parent-2.5.0.pom):

    <repositories>
            <repository>
                    <id>erichseifert.de</id>
                    <url>http://mvn.erichseifert.de/maven2</url>
            </repository>
    </repositories>

现在回到原来的问题:当我在我的机器上构建MoSKito时,从http://mvn.erichseifert.de/maven2下载了VectorGraphics2D。我在构建日志中看到它,它也存在于存储库中,文件_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]

是否有任何设置可以解决此问题,因此它至少是确定性的?

P.S。谁将此问题标记为maven force update dependencies问题的副本,它与依赖关系更新无关。它是关于maven从引用项目中指定的存储库中解析工件。有时候它有效,有时它不会。

1 个答案:

答案 0 :(得分:0)

好的,我发现了,并在此处发布了答案。无法下载工件的系统在其settings.xml中有一个带有

的活动镜像
<mirrorOf>*</mirrorOf>

这阻止了mvn从链接存储库下载工件,镜像现在没有发生什么,也无法下载工件。我们用两种方式解决了这个问题(两台不同的机器): 1)将mirrorOf从*更改为central 2)手动上传工件作为镜像连接中的第三方工件(代理也可以这样做),

谢谢你,祝你好运; - )

相关问题