Eclipse下,修改MAVEN 中央倉庫地址,解決maven下載慢問題

來源:互聯網
上載者:User

好久不寫代碼,突然需要寫點小程式,手生,記錄知識點備忘:

表現:匯入項目到工作空間後,編譯時間顯示maven在下載資源,但速度巨慢,無法忍受。


eclipse中修改maven中央倉庫:2種方式

方式1:(已測試)

作用於所有工作空間:

1、逐項開啟:eclipse->preference->Maven->User Settings。按視窗中的User Settings文字框顯示的路徑,建立settings.xml檔案,或修改路徑後建立檔案。

2、關閉視窗後重新開啟,點擊“open file”,在IDE中開啟該設定檔,出現“could not read settings.xml”不必管。

3、複製下列內容至設定檔,其中<mirror></mirror>部分為國內鏡像。

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><mirrors><!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | --> <mirror>    <id>alimaven</id>    <name>aliyun maven</name>    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>    <mirrorOf>central</mirrorOf>  </mirror>  <mirror>     <id>uk</id>      <mirrorOf>central</mirrorOf>      <name>Human Readable Name for this Mirror.</name>      <url>http://uk.maven.org/maven2/</url>   </mirror>   <mirror>    <id>CN</id>    <name>OSChina Central</name>    <url>http://maven.oschina.net/content/groups/public/</url>    <mirrorOf>central</mirrorOf>  </mirror>  <mirror>    <id>nexus</id>    <name>internal nexus repository</name>    <url>http://repo.maven.apache.org/maven2</url>    <mirrorOf>central</mirrorOf>  </mirror></mirrors><profiles><profile><id>default</id><repositories><repository><id>nexus</id><name>local private nexus</name><url>http://maven.oschina.net/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>nexus</id><name>local private nexus</name><url>http://maven.oschina.net/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles></settings>

4、"apply"後配置生效,重新編譯即可。


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.