Maven实战(Maven+Nexus建立私服【Linux系统】)
準(zhǔn)備工作
下載及配置Maven3:http://www.cnblogs.com/leefreeman/archive/2013/03/05/2944519.html
下載Nexus:http://nexus.sonatype.org/downloads/
安裝配置Nexus
Nexus提供了兩種安裝方式,一種是內(nèi)嵌Jetty的bundle,只要你有JRE就能直接運(yùn)行。第二種方式是WAR,你只須簡單的將其發(fā)布到web容器中即可使用。
建議下載上面這個(gè),下載完成之后,解壓到linux的相應(yīng)位置:
上圖中的 nexus-2.3.1-01和sonatype-work目錄就是解壓tar包后的兩個(gè)目錄,nexus-2.3.1-01中是nexus的核心文件,sonatype-work,會(huì)將下載來的開發(fā)包放置在其中。
cd /data/program/nexus-2.3.1-01/bin/jsw ll可以看到很多操作系統(tǒng)的版本目錄,選擇你的linux系統(tǒng)版本進(jìn)去,如果不知道可以:
uname –a然后進(jìn)入:
啟動(dòng)nexus
./nexus startnexus啟動(dòng)成功,訪問:http://192.168.6.204:8081/nexus/
點(diǎn)擊右上角的“l(fā)og on”進(jìn)行登錄,默認(rèn)用戶名和密碼:admin / admin123
可以看到左邊菜單:
點(diǎn)擊“Repositories”
關(guān)于hosted、proxy、group的概念這里就不講了,大都介紹nexus的都有介紹,這里主要講需要做的配置?
點(diǎn)擊Central,并切換到Configuration選項(xiàng)卡。
將Download Remote Indexes項(xiàng)設(shè)為True!這將打開nexus的下載遠(yuǎn)程索引的功能,便于使用nexus的搜索功能。
配置Maven使用Nexus私服
修改Maven的settings.xml 文件。
在<settings></settings>之間添加:
<profiles><profile> <id>dev</id> <repositories> <repository> <id>local-nexus</id> <url>http://192.168.6.204:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <!-- activeProfiles | List of profiles that are active for all builds. | --> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>注意原settings.xml 文件中,已經(jīng)存在profiles、activeProfiles的節(jié)點(diǎn)。
如果你的eclipse,安裝了m2eclipse插件,則設(shè)置:
這樣當(dāng)項(xiàng)目需要開發(fā)包時(shí),就會(huì)在本地倉庫查找,如果查找不到就會(huì)到私服上查找,如果還查找不找就會(huì)去中央倉庫去查找。下次等另一人需要同樣的開發(fā)包時(shí),就會(huì)從私服中查找,效果遠(yuǎn)比他重新從中央倉庫下載快多了。
轉(zhuǎn)載于:https://www.cnblogs.com/tonychai/p/5189164.html
總結(jié)
以上是生活随笔為你收集整理的Maven实战(Maven+Nexus建立私服【Linux系统】)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 孕妇梦到女鬼是什么意思
- 下一篇: 整理Linux查看系统日志的一些经常使用