您的位置:首页 > 其它

[Maven]Nexus 安装与配置

2014-08-11 17:39 411 查看


转载于: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代码  



<?xml version="1.0" encoding="UTF-8"?>  

<settings xmlns="http://
15e52
maven.apache.org/SETTINGS/1.0.0"   

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   

          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  

            

  <localRepository>D:\bisoft\tools\maven3\repository</localRepository>  

  

  <pluginGroups>  

    <pluginGroup>org.mortbay.jetty</pluginGroup>  

    <pluginGroup>org.codehaus.cargo</pluginGroup>  

  </pluginGroups>  

  

  <proxies>  

  </proxies>  

  

  <servers>  

    <server>  

        <id>releases</id>  

        <username>admin</username>  

        <password>admin123</password>  

    </server>  

    <server>  

        <id>snapshots</id>  

        <username>admin</username>  

        <password>admin123</password>  

    </server>    

  </servers>  

  

  <mirrors>  

    <mirror>  

      <id>nexus</id>  

      <mirrorOf>*</mirrorOf>  

      <url>http://localhost:8081/nexus/content/groups/public</url>  

    </mirror>  

  </mirrors>  

  

  <profiles>  

    <profile>  

      <id>nexus</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>  

  </profiles>  

  

  <activeProfiles>  

    <activeProfile>nexus</activeProfile>  

  </activeProfiles>  

</settings>  

  

</settings>  

配置部署 
pom.xml 

Xml代码  



<distributionManagement>   

<repository>   

    <id>releases</id>   

    <name>Internal Releases</name>   

    <url>http://localhost:8081/nexus/content/repositories/releases</url>   

</repository>   

<snapshotRepository>   

    <id>Snapshots</id>   

    <name>Internal Snapshots</name>   

    <url>http://localhost:8081/nexus/content/repositories/snapshots</url>   

</snapshotRepository>   

</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 目录即可.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  maven nexus