我要很無聊的說說怎么找到這個東東來下載的
1. 官方網(wǎng)站
2. 找到get nexus
3. 找到免費版本下載(免費試用肯定是收費的)
4. 啟動cmd命令
(1)輸入nexus:將提示 以下幾種命令;
(2)nexus install 安裝服務(wù)
(3)nexus start 啟動服務(wù)
5. 訪問 http://localhost:8081/nexus/
右上角 用戶登錄,默認的用戶名和密碼:admin/admin123
6. 倉庫類型
- group:
可以把其他的倉庫加入到一個組中檐春,就樣我們關(guān)聯(lián)一個組就可以關(guān)聯(lián)到若干倉庫 - proxy:
代理倉庫,當我們本地沒有對應(yīng)的資源的時祭埂,會通過類型倉庫去遠程倉庫(外網(wǎng))下載贯吓,這里Apache Snapshots專門用來下載apache的資源 - hosted:
我們發(fā)布的模塊會被提交到hosted類型的倉庫懈凹,這樣就能被組內(nèi)其他成員依賴到我們的模塊; 如果我們模塊pom中的版本含有snapshot字樣就表明這是一個快照模塊悄谐,那么發(fā)布時會被提交到Snapshots倉庫中
<version>0.0.1-SNAPSHOT</version>
7. 倉庫配置
我們代理倉庫的資源是通過索引來讓我們找到的介评,所以我們要打開代理倉庫的索引,并且配置代理倉庫的遠程下載地址
推薦:http://maven.aliyun.com/nexus/content/groups/public/
8. 使用私服
私服搭好了之后爬舰,我們需要在項目使用該私服了
1. 在根模塊的pom中配置
<repositories>
<repository>
<id>nexus</id>
<name>nexus repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<!-- 為什么要開啟快照呢们陆? 因為group中包含了我們模塊上傳的倉庫,而我們上傳的模塊又是snapshots類型的情屹,所以需要開啟 -->
</repository>
</repositories>
這是在項目中去設(shè)置坪仇,也就是說不同的項目都需要這樣去配置,好像有點麻煩垃你;我們知道每個maven項目使用的maven肯定都是一樣的椅文,那么我們可以去修改maven的配置文件呀
2. 在maven配置文件(settings.xml)中配置
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>internal nexus repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
這里貧僧要提個醒喂很,最好看看eclipse中maven的配置,之前被坑慘了
9. 流程圖
10. 發(fā)布項目到私服
1. 根模塊pom中配置
選擇要發(fā)布到的倉庫
<distributionManagement>
<repository>
<id>helloweb-release</id>
<name>helloweb release resp</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>helloweb-snapshot</id>
<name>helloweb snapshot resp</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
2. maven配置文件中配置
私服的倉庫是有權(quán)限的皆刺,需要配置對應(yīng)的用戶名和密碼
<servers>
<server>
<id>helloweb-release</id><!-- 對應(yīng)distributionManagement中配置的id -->
<username>deployment</username><!-- 默認的用戶名和密碼 -->
<password>deployment123</password>
</server>
<server>
<id>helloweb-snapshot</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
3. 補充
這只是將項目發(fā)現(xiàn)到了默認的倉庫少辣,其實我們可以針對不同的項目倉庫不同的倉庫,這些就日后再記錄吧
具體教程請看或百度
http://blog.csdn.net/tutftn/article/details/51771800
http://www.cnblogs.com/demingblog/p/3840174.html
關(guān)于snapshot 和 release版本的問題
http://www.mzone.cc/article/277.html