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里面的那段删除就可以了。