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