1、下載war包,部署到tomcat中,啟動tomcat;
2、訪問:http://xxx/nexus-1.1.1/index.html;
3、用admin/admin123登錄;
4、修改admin的密碼,但是不要修改別的屬性和修改別的用戶信息
5、進入administration中的repositories,依次修改三個type是proxy的項目,將其Download Remote Indexes修改為true;然后郵件他們,分別re-index一下;
6、將你自己機器上的manven緩存(一般是在C:\Documents and Settings\登錄名\.m2下面)全部拷貝到/home/你的用戶名/sonatype-work/nexus/storage下面的central和releases各一份;
7、修改你本地的(一般是在C:\Documents and Settings\登錄名\.m2下面)setting.xml文件改成下面的:
- <settings>??
- ??????<proxies>??
- ????????<proxy>??
- ??????????<id>normal</id>??
- ??????????<active>true</active>??
- ??????????<protocol>http</protocol>??
- ??????????<username>deployment</username>??
- ??????????<password>deploy</password>??
- ??????????<host>172.19.0.177:8080/nexus-1.1.1</host>??
- ??????????<port>80</port>??
- ??????????<nonProxyHosts>172.19.0.177:8080/nexus-1.1.1</nonProxyHosts>??
- ????????</proxy>??
- ??????</proxies>??
- ??????<servers>??
- ??????</servers>??
- ??????<mirrors>??
- ?????????<mirror>??
- ??????????<id>nexus-public-snapshots</id>??
- ??????????<mirrorOf>public-snapshots</mirrorOf>??
- ??????????<url>http://172.19.0.177:8080/nexus-1.1.1/content/groups/public-snapshots</url>??
- ????????</mirror>??
- ????????<mirror>??
- ????????????
- ??????????<id>nexus</id>??
- ??????????<mirrorOf>*</mirrorOf>??
- ??????????<url>http://172.19.0.177:8080/nexus-1.1.1/content/groups/public</url>??
- ????????</mirror>??
- ??????</mirrors>??
- ??????<profiles>??
- ????????<profile>??
- ??????????<id>development</id>??
- ??????????<repositories>??
- ????????????<repository>??
- ??????????????<id>central</id>??
- ??????????????<url>http://central</url>??
- ??????????????<releases><enabled>true</enabled></releases>??
- ??????????????<snapshots><enabled>true</enabled></snapshots>??
- ????????????</repository>??
- ??????????</repositories>??
- ?????????<pluginRepositories>??
- ????????????<pluginRepository>??
- ??????????????<id>central</id>??
- ??????????????<url>http://central</url>??
- ??????????????<releases><enabled>true</enabled></releases>??
- ??????????????<snapshots><enabled>true</enabled></snapshots>??
- ????????????</pluginRepository>??
- ??????????</pluginRepositories>??
- ????????</profile>??
- ????????<profile>??
- ??????????<id>public-snapshots</id>??
- ??????????<repositories>??
- ????????????<repository>??
- ??????????????<id>public-snapshots</id>??
- ??????????????<url>http://public-snapshots</url>??
- ??????????????<releases><enabled>false</enabled></releases>??
- ??????????????<snapshots><enabled>true</enabled></snapshots>??
- ????????????</repository>??
- ??????????</repositories>??
- ?????????<pluginRepositories>??
- ????????????<pluginRepository>??
- ??????????????<id>public-snapshots</id>??
- ??????????????<url>http://public-snapshots</url>??
- ??????????????<releases><enabled>false</enabled></releases>??
- ??????????????<snapshots><enabled>true</enabled></snapshots>??
- ????????????</pluginRepository>??
- ??????????</pluginRepositories>??
- ????????</profile>??
- ??????</profiles>??
- ????????<activeProfiles>??
- ????????<activeProfile>development</activeProfile>??
- ??????</activeProfiles>??
- </settings>??
?
??? 將172.19.0.177地址修改為你自己的服務器地址
???
8、在你的項目中的pom.xml中增加一段:
- <distributionManagement>??
- ????????<repository>??
- ????????????<id>repo</id>??
- ????????????<name>public</name>??
- ????????????<url>http://172.19.0.177:8080/nexus-1.1.1/content/repositories/releases</url>??
- ????????</repository>??
- ????????<snapshotRepository>??
- ????????????<id>Snapshots</id>??
- ????????????<name>Snapshots</name>??
- ????????????<url>http://172.19.0.177:8080/nexus-1.1.1/content/repositories/snapshots</url>??
- ????????</snapshotRepository>??
- ????</distributionManagement>??
?
這樣一來經過我的測試,如果你在沒有局域網的環境中(也就是沒辦法訪問你的私服),只要將pom里面的那段刪除就可以了。