记一次maven的大坑maven配置本地私服后插件也去中央仓库下载

前提:maven的settings中已经配置好私有仓库
pom中所有的jar包都是从私有仓库下载,但是!!!执行mvn的插件还是会从https://repo.maven.apache.org/maven2这个maven的网站上下载.我是在使用jenkins自动部署的时候出现的这个问题,不知道其他人是什么时候出现的.
上网查找了许多资料,因为不知道如何搜索,费了一些功夫,最后才找到,mvn的插件去maven地址下载的原因是
所有的pom文件都是继承了super pom:

 <repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>http://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Central Repository</name>
      <url>http://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories>

这里的地址是maven官方仓库的地址,我们需要手动更改地址为自己的maven私有仓库地址
在自定义pom中添加

<repositories>
    <repository>
        <id>central</id>
        <url>http://host:port/content/groups/public(这里换成自己的私有maven仓库地址)</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>http://host:port/content/groups/public(这里换成自己的私有maven仓库地址)</url>
    </pluginRepository>
</pluginRepositories>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值