Terry.Li-彬

虚其心,可解天下之问;专其心,可治天下之学;静其心,可悟天下之理;恒其心,可成天下之业。

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  143 随笔 :: 344 文章 :: 130 评论 :: 0 Trackbacks
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文件改成下面的:
Xml代码
  1. <settings>  
  2.       <proxies>  
  3.         <proxy>  
  4.           <id>normal</id>  
  5.           <active>true</active>  
  6.           <protocol>http</protocol>  
  7.           <username>deployment</username>  
  8.           <password>deploy</password>  
  9.           <host>172.19.0.177:8080/nexus-1.1.1</host>  
  10.           <port>80</port>  
  11.           <nonProxyHosts>172.19.0.177:8080/nexus-1.1.1</nonProxyHosts>  
  12.         </proxy>  
  13.       </proxies>  
  14.       <servers>  
  15.       </servers>  
  16.       <mirrors>  
  17.          <mirror>  
  18.           <id>nexus-public-snapshots</id>  
  19.           <mirrorOf>public-snapshots</mirrorOf>  
  20.           <url>http://172.19.0.177:8080/nexus-1.1.1/content/groups/public-snapshots</url>  
  21.         </mirror>  
  22.         <mirror>  
  23.           <!--This sends everything else to /public -->  
  24.           <id>nexus</id>  
  25.           <mirrorOf>*</mirrorOf>  
  26.           <url>http://172.19.0.177:8080/nexus-1.1.1/content/groups/public</url>  
  27.         </mirror>  
  28.       </mirrors>  
  29.       <profiles>  
  30.         <profile>  
  31.           <id>development</id>  
  32.           <repositories>  
  33.             <repository>  
  34.               <id>central</id>  
  35.               <url>http://central</url>  
  36.               <releases><enabled>true</enabled></releases>  
  37.               <snapshots><enabled>true</enabled></snapshots>  
  38.             </repository>  
  39.           </repositories>  
  40.          <pluginRepositories>  
  41.             <pluginRepository>  
  42.               <id>central</id>  
  43.               <url>http://central</url>  
  44.               <releases><enabled>true</enabled></releases>  
  45.               <snapshots><enabled>true</enabled></snapshots>  
  46.             </pluginRepository>  
  47.           </pluginRepositories>  
  48.         </profile>  
  49.         <profile>  
  50.           <id>public-snapshots</id>  
  51.           <repositories>  
  52.             <repository>  
  53.               <id>public-snapshots</id>  
  54.               <url>http://public-snapshots</url>  
  55.               <releases><enabled>false</enabled></releases>  
  56.               <snapshots><enabled>true</enabled></snapshots>  
  57.             </repository>  
  58.           </repositories>  
  59.          <pluginRepositories>  
  60.             <pluginRepository>  
  61.               <id>public-snapshots</id>  
  62.               <url>http://public-snapshots</url>  
  63.               <releases><enabled>false</enabled></releases>  
  64.               <snapshots><enabled>true</enabled></snapshots>  
  65.             </pluginRepository>  
  66.           </pluginRepositories>  
  67.         </profile>  
  68.       </profiles>  
  69.         <activeProfiles>  
  70.         <activeProfile>development</activeProfile>  
  71.       </activeProfiles>  
  72. </settings>  
 

    将172.19.0.177地址修改为你自己的服务器地址
   
8、在你的项目中的pom.xml中增加一段:

Xml代码
  1. <distributionManagement>  
  2.         <repository>  
  3.             <id>repo</id>  
  4.             <name>public</name>  
  5.             <url>http://172.19.0.177:8080/nexus-1.1.1/content/repositories/releases</url>  
  6.         </repository>  
  7.         <snapshotRepository>  
  8.             <id>Snapshots</id>  
  9.             <name>Snapshots</name>  
  10.             <url>http://172.19.0.177:8080/nexus-1.1.1/content/repositories/snapshots</url>  
  11.         </snapshotRepository>  
  12.     </distributionManagement>  
 


这样一来经过我的测试,如果你在没有局域网的环境中(也就是没办法访问你的私服),只要将pom里面的那段删除就可以了。

posted on 2010-09-26 00:16 礼物 阅读(1365) 评论(0)  编辑  收藏 所属分类: Maven2