[Maven]Nexus 安装与配置


转载于:http://w26.iteye.com/blog/1547096


下载Nexus 
http://www.sonatype.org/nexus/go 


安装 
解压即可 
D:\bisoft\tools 
          nexus-2.0.4-1 
          sonatype-work 


配置环境变量 
NEXUS_HOME=D:\bisoft\tools\nexus-2.0.4-1 
PATH 添加  %NEXUS_HOME%\bin\jsw\windows-x86-64 

$NEXUS_HOME/conf/nexus.properties 可修改基本配置信息,如 sonatype-work 目录位置. 
nexus-work=${bundleBasedir}/../sonatype-work/nexus 


故障解决方案: 
The nexus-webapp service was launched, but failed to start. 

环境变量|系统变量|JAVA_HOME & PATH. 
注意是系统变量下,不是用户变量. 


运行 
install-nexus.bat 
console-nexus.bat 
nexus start|stop 

查看日志 
%NEXUS_HOME%/logs/wrapper.log 


进入Nexus管理界面 
http://localhost:8081/nexus 
管理员 
账号:admin 
密码:admin123 

部署用户: 
deployment 
deployment123 

匿名用户: 



$NEXUS_HOME/conf/wrapper-override.conf 可重写nexus服务配置. 


启用远程索引下载 
左边| Repositories|选择一个远程代理仓库|下边Tab Configuration|Download Remote Indexes|true|Save|上边菜单Refresh. 



默认有三个代理仓库: 
Maven Central repository 
Apache Snapshot repository 
Codehaus Snapshot repository 

现在自动开始下载索引文件.这个只会下载索引,不会下载JAR.除非手动下载啦. 


手动下载: 
下边TAB Brower Index | 找到JAR | 右边 |download. 
现在,在D:\bisoft\tools\sonatype-work\nexus\storage\central\中缓存了JAR包. 

10 
安装为服务 
64位执行 nexus.bat install 报错,原因是权限不啦. 

解决办法: 
新建一个nexus-install.bat: 
nexus.bat install 

然后右键|以管理员身份运行(好像管理员必须要密码才行....) 

11 
管理组,组是一个很好的东西,它能组合多个仓库并映射到一个URL上. 
Nexus 默认提供一个组:Public Repositories. 




Ordered Group Repositories:新加的仓库,将仓库加入其中即可. 


12 
改变nexus监听端口 
$NEXUS_HOME/conf/nexus.properties 
application-port=8081 

13 
配置 Maven 
%user.dir%/.m2/settings.xml 

Xml代码   收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"   
  3.           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
  4.           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
  5.             
  6.   <localRepository>D:\bisoft\tools\maven3\repository</localRepository>  
  7.   
  8.   <pluginGroups>  
  9.     <pluginGroup>org.mortbay.jetty</pluginGroup>  
  10.     <pluginGroup>org.codehaus.cargo</pluginGroup>  
  11.   </pluginGroups>  
  12.   
  13.   <proxies>  
  14.   </proxies>  
  15.   
  16.   <servers>  
  17.     <server>  
  18.         <id>releases</id>  
  19.         <username>admin</username>  
  20.         <password>admin123</password>  
  21.     </server>  
  22.     <server>  
  23.         <id>snapshots</id>  
  24.         <username>admin</username>  
  25.         <password>admin123</password>  
  26.     </server>    
  27.   </servers>  
  28.   
  29.   <mirrors>  
  30.     <mirror>  
  31.       <id>nexus</id>  
  32.       <mirrorOf>*</mirrorOf>  
  33.       <url>http://localhost:8081/nexus/content/groups/public</url>  
  34.     </mirror>  
  35.   </mirrors>  
  36.   
  37.   <profiles>  
  38.     <profile>  
  39.       <id>nexus</id>  
  40.       <repositories>  
  41.         <repository>  
  42.           <id>central</id>  
  43.           <url>http://central</url>  
  44.           <releases><enabled>true</enabled></releases>  
  45.           <snapshots><enabled>true</enabled></snapshots>  
  46.         </repository>  
  47.       </repositories>  
  48.      <pluginRepositories>  
  49.         <pluginRepository>  
  50.           <id>central</id>  
  51.           <url>http://central</url>  
  52.           <releases><enabled>true</enabled></releases>  
  53.           <snapshots><enabled>true</enabled></snapshots>  
  54.         </pluginRepository>  
  55.       </pluginRepositories>  
  56.     </profile>  
  57.   </profiles>  
  58.   
  59.   <activeProfiles>  
  60.     <activeProfile>nexus</activeProfile>  
  61.   </activeProfiles>  
  62. </settings>  
  63.   
  64. </settings>  


配置部署 
pom.xml 

Xml代码   收藏代码
  1. <distributionManagement>   
  2. <repository>   
  3.     <id>releases</id>   
  4.     <name>Internal Releases</name>   
  5.     <url>http://localhost:8081/nexus/content/repositories/releases</url>   
  6. </repository>   
  7. <snapshotRepository>   
  8.     <id>Snapshots</id>   
  9.     <name>Internal Snapshots</name>   
  10.     <url>http://localhost:8081/nexus/content/repositories/snapshots</url>   
  11. </snapshotRepository>   
  12. </distributionManagement>  



14 
上传第三方包 
14.1  
mvn deploy:deploy-file -Dgroup -Dartifact 
-Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar   
-Durl=http://localhost:8081/nexus/content/repositories/thirdparty   
-Drepository 

14.2 
直接复制到仓库 

14.3 
界面上传 

15. 
备份 

直接备份 sonatype-work 目录即可.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值