**
下載地址:http://www.sonatype.org/nexus/go
我用的這個版本:nexus-2.14.3-02-bundle.tar.gz
**
**
1、解壓 nexus-2.14.3-02-bundle.tar.gz
tar xvf nexus-2.14.3-02-bundle.tar.gz
2、解壓完後生成2個目錄:nexus-2.14.3-02和sonatype-work,前者包含了nexus的運行環境和應用程序,後者包含了你自己的配置和數據;
3、啟動nexus
cd nexus-2.14.3-02/bin/./nexus start/stop/restart
**注意:nexus root啟動異常:WARNING - NOT RECOMMENDED TO RUN AS ROOT 解決方案 修改%nexus_home%/bin/下的nexus 找到#RUN_AS_USER=改為RUN_AS_USER=root** 4. 訪問網址:http://192.168.4.241:8081/nexus/看到Nexus歡迎頁證明Nexus啟動成功; 5. 右上角以admin登錄,默認用戶名/密碼:admin/admin123。
**
**
1、替換Maven默認配置文件(settings.xml),內容如下:
<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <!-- id must be the same with pom.xml --> <id>release</id> <username>admin</username> <password>******</password> </server> <server> <!-- id must be the same with snapshotRepository section in pom.xml --> <id>snapshot</id> <!-- The username and password of the nexus server --> <username>admin</username> <password>******</password> </server> </servers> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.4.241:8081/nexus/content/groups/public/</url> </mirror> </mirrors></settings>
2、本地上傳依賴到Nexus服務器的兩種方式: 通過網頁上傳和通過maven的方式depoly,在項目的pom.xml 加入如下配置:
<!-- For deploy your own maven jars --> <distributionManagement> <!-- Nexus Release Deploy Repository --> <repository> <id>release</id> <name>Nexus release repository</name> <url>http://192.168.4.241:8081/nexus/content/repositories/releases</url> </repository> <!-- snapshot repository --> <snapshotRepository> <id>snapshot</id> <name>Nexus Snapshot Deploy Repository</name> <url>http://192.168.4.241:8081/nexus/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>
注意:此處id應與settings.xml裡面的id一致
到此配置完成,可以在本地引入依賴,看私服是否生成相應jar包
http://www.bkjia.com/Linuxjc/1195999.htmlwww.bkjia.comtrue