[Maven]Nexus 安装与配置

阅读更多
1
下载Nexus
http://www.sonatype.org/nexus/go

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

3
配置环境变量
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

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

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

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

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

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

部署用户:
deployment
deployment123

匿名用户:


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

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



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

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

9
手动下载:
下边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



		  
  D:\bisoft\tools\maven3\repository

  
  	org.mortbay.jetty
  	org.codehaus.cargo
  

  
  

  
  	
  		releases
  		admin
  		admin123
  	
  	
  		snapshots
  		admin
  		admin123
  	  
  

  
    
      nexus
      *
      http://localhost:8081/nexus/content/groups/public
    
  

  
    
      nexus
      
        
          central
          http://central
          true
          true
        
      
     
        
          central
          http://central
          true
          true
        
      
    
  

  
    nexus
  






配置部署
pom.xml

 
 
    releases 
    Internal Releases 
    http://localhost:8081/nexus/content/repositories/releases 
 
 
    Snapshots 
    Internal Snapshots 
    http://localhost:8081/nexus/content/repositories/snapshots 
 




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 目录即可.


你可能感兴趣的:(nexus,maven)