[轉]使用maven鏡像

來源:互聯網
上載者:User

標籤:

綜述

用maven做項目,最鬱悶的莫過於某些依賴庫下載不了。被牆了,你懂的。使用maven鏡像倉庫及其重要,特別是國內的鏡像,可以有效緩解被牆疼痛。

常用的鏡像國外鏡像

ibiblio.org

<mirror>       <id>ibiblio</id>       <mirrorOf>central</mirrorOf>       <name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>       <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>  </mirror>  

jboss

<mirror>       <id>jboss-public-repository-group</id>       <mirrorOf>central</mirrorOf>       <name>JBoss Public Repository Group</name>       <url>http://repository.jboss.org/nexus/content/groups/public</url>  </mirror>

repo2

<mirror>  <id>repo2</id>  <mirrorOf>central</mirrorOf>  <name>Human Readable Name for this Mirror.</name>  <url>http://repo2.maven.org/maven2/</url></mirror>

uk.maven.org

<mirror>  <id>ui</id>  <mirrorOf>central</mirrorOf>  <name>Human Readable Name for this Mirror.</name> <url>http://uk.maven.org/maven2/</url></mirror>
國內鏡像

oschina.net

<mirror>    <id>nexus-osc</id>    <mirrorOf>*</mirrorOf>    <name>Nexus osc</name>    <url>http://maven.oschina.net/content/groups/public/</url></mirror>

net.cn

<mirror>    <id>net-cn</id>    <mirrorOf>central</mirrorOf>    <name>Human Readable Name for this Mirror.</name>    <url>http://maven.net.cn/content/groups/public/</url>    </mirror>
使用鏡像

下文以oschina.net的鏡像為例子.

1.Maven 的安裝目錄下的 conf 檔案下有個settings.xml檔案,編輯該檔案

2.在<mirrors>中插入:

<mirror>    <id>nexus-osc</id>    <mirrorOf>*</mirrorOf>    <name>Nexus osc</name>    <url>http://maven.oschina.net/content/groups/public/</url></mirror>

3.這裡是配置 Maven 的 mirror 地址指向OSChina 的 Maven 鏡像地址。 在執行 Maven 命令的時候, Maven 還需要安裝一些外掛程式包,這些外掛程式包的也讓其指向 oschina.net 的 Maven 地址。在<profiles>中插入:

<profile>    <id>jdk-1.4</id>    <activation>    <jdk>1.4</jdk>    </activation>    <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>

ps:http://www.waylau.com/use-maven-mirrors/
http://search.maven.org/#browse

[轉]使用maven鏡像

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.