在pom.xml中覆盖mvn settings.xml.仅定义项目特定的存储库 [英] Override mvn settings.xml in your pom.xml. Define only project specific repos

查看:683
本文介绍了在pom.xml中覆盖mvn settings.xml.仅定义项目特定的存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.m2中有以下内容,禁用了默认的远程存储库:

I have the following in .m2, disabling the default remote repo:

<?xml version="1.0" encoding="UTF-8"?> 
<settings>
<mirrors>
  <mirror>
    <id>my.mirror</id>
    <name>My Mirror</name>
    <url>https://repo.maven.apache.org/alwaysfail</url>
    <mirrorOf>*</mirrorOf>
  </mirror>
</mirrors>

现在我在项目pom.xml中添加了它

Now I added this in my project pom.xml

<repositories>
    <repository>
        <id>myproject.repo</id>
        <url>https://repo.maven.apache.org/maven2</url>
    </repository>
</repositories>

但是它没有提取我的项目特定的远程仓库并开始下载,我在做什么错了?

But it does not pick up my project specific remote repo and start downloading, what am I doing wrong?

推荐答案

setting.xml允许您覆盖pom.xml中的定义,而不是相反.如果不想在特定版本中使用settings.xml中的替代,则可以准备另一个设置文件并显式调用它:

setting.xml allows you to override definitions in pom.xml, not the other way round. If you want to not use the overriding in settings.xml in a particular build, you could prepare another settings file and call it explicitly:

$ mvn install -s /path/to/no-repo-override.xml

这篇关于在pom.xml中覆盖mvn settings.xml.仅定义项目特定的存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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