maven仓库提示“Downloading: http://repo.maven.apache.org/maven2/”


问题描述

maven setting.xml中配置私有库,但是在mvn install时仍然提示Downloading: http://repo.maven.apache.org/maven2/

原因

网上查了很多资料发现了解到所有自定义pom.xml都是继承自super pom,所以maven项目下载一些jar包时,默认会从中央仓库下载

<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>

解决办法

在项目的pom文件中手动指定下私有仓库

<repositories>
    <repository>
        <id>hanxiaohan</id>
        <url>http://host:port/content/groups/public</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>hanxiaohan</id>
        <url>http://host:port/content/groups/public</url>
    </pluginRepository>
</pluginRepositories>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM