如何配置Maven以忽略POM文件中指定的存储库? [英] How do you configure maven to ignore repositories specified in POM files?

查看:203
本文介绍了如何配置Maven以忽略POM文件中指定的存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在公司Intranet上有一个项目(阅读-没有外部Internet访问).我有一台运行Artifactory的服务器,其中包含所有必需的Maven工件.我有一个settings.xml文件将maven指向正在运行的Artifactory服务器.万事如意,maven可以下载依赖项,直到在POM文件中指定存储库的工件为止(在我的情况下为org/eclipse/jetty/jetty-project/7.5.4.v20111024/jetty-project-7.5.4.v20111024.pom) .然后,maven尝试从POM文件中指定的存储库(而不是Artifactory)中加载剩余的依赖项.这破坏了构建.您如何配置Maven以忽略POM文件中指定的存储库?

I have a project on a company intranet (read - no outside internet access). I have a server running Artifactory with all required maven artifacts. I have a settings.xml file pointing maven to the running Artifactory server. Everything is happy and maven can download dependencies until an artifact specifying a repository in the POM file (in my case org/eclipse/jetty/jetty-project/7.5.4.v20111024/jetty-project-7.5.4.v20111024.pom). Then maven attempts to load the remaining dependencies from the repo specified in the POM file instead of from Artifactory. This breaks the build. How do you configure maven to ignore repositories specified in POM files?

谢谢

内森

推荐答案

作为解决方法,请在settings.xml中用相同的ID定义另一个存储库(是否为oss.sonatype.org,在

As a workaround, define another repository in your settings.xml with the same ID (is it oss.sonatype.org, defined in jetty-parent:19, that's the problem?) and point it at your repo. Maven will use that definition in favour of the one in the pom.

有一个针对Maven的公开问题( MNG-3056 )允许对此进行配置,以便仅使用您的存储库;通常,如果您有本地存储库,那将是您想要的行为.

There's an open issue filed against Maven (MNG-3056) to allow this to be configured so only your repo would be used; in general, if you have a local repository, that would be the behaviour you would want.

这篇关于如何配置Maven以忽略POM文件中指定的存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆