一、nexus的安裝:
1、配置環境變量:
Path=%MEXUS_HOME%\bin;......
2、驗證環境變量是否配置成功:
cmd>nexus 出現如下界面說明環境變量配置成功。
<a href="http://s3.51cto.com/wyfs02/M00/7E/F2/wKiom1cNu1zDMREsAAALgXjbkCw345.png" target="_blank"></a>
3、安裝服務:
cmd>nexus install
4、啟動nexus:
cmd>nexus start
5、通路nexus:
http://localhost:8081/nexus/index.html
登入資訊:admin=admin123
看到如下界面,大功告成!!!
<a href="http://s5.51cto.com/wyfs02/M02/7E/F0/wKioL1cNvY2gci9BAAFT_4Aj73g108.png" target="_blank"></a>
二、Maven倉庫配置:
1、maven的預設情況是首先通路“本地倉庫”,本地沒有直接通路“中央倉庫”。
通路中央倉庫的配置是在D:\tool\apache-maven-3.0.4\lib\maven-model-builder-3.0.4.jar的pom.xml中。
<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>
2、可以通過配置maven的setting.xml檔案的profile,實作首先通路“本地倉庫”,本地倉庫沒有通路“私有Nexus倉庫”,“私有Nexus倉庫”沒有才通路“中央倉庫”。
)配置profile:
<profile>
<id>nexusProfile</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<!--預設snapshot是關閉的,需要手工開啟-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
2.)配置activeProfile(激活profile):
<activeProfile>nexusProfile</activeProfile>
3、可以通過配置maven的setting.xml檔案的mirror,實作首先通路“本地倉庫”,本地倉庫沒有通路“私有Nexus倉庫”,“私有Nexus倉庫”沒有“不”通路“中央倉庫”。
<mirror>
<id>nexusmirror</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
注意:隻要mirrorOf的工廠(如nexus、central)要通路,都會自動來找鏡像mirror,如果mirror無法通路到就不會再去中央工廠通路,使用*表示所有的工廠都使用這個鏡像通路,使用*這是推薦的做法。
本文轉自lzf0530377451CTO部落格,原文連結: http://blog.51cto.com/8757576/1763346,如需轉載請自行聯系原作者