<1>将E:\nexus\nexus-2.13.0-01\bin目录添加到path中,cmd-->nexus, 通过nexus install,nexus start,nexus uninstall来

安装,启动和卸载服务

D:\nexus-2.12.0-01-bundle\nexus-2.12.0-01\conf\nexus.properties修改端口号

nexus默认端口8081,后台访问地址:http://localhost:8081/nexus

<2>修改bin->jsw->conf->wrapper.conf中jdk的路径.注意不同nexus版本可能适应不同的jdk版本

wrapper.java.command=C:\Program Files (x86)\Java\jdk1.7.0_09\bin\java

<3>配置maven下setting.xml

   <1>添加账户名和密码,在项目通过mvn:deploy命令发布jar到nexus仓库中去需要配置

   <2>配置nexus工厂,profile节点.即项目下载jar时从哪个地址下载jar包.(本地nexus工厂路径)

     本地仓库->nexus工厂->maven中央仓库

    <3>通过配置镜像mirror可统一对所有工厂设置同一个访问路径. 

   <4>发布本地项目到nexus仓库中时,settings.xml中配置用户

<server>
 <id>user-release</id>
 <username>cms</username>
 <password>cms123</password>
</server>

该用户需要在nexus后台配置对响应仓库的操作权限

    <5>mvn deploy时配置:

    <distributionManagement>
           <repository>
                  <id>cms-releases</id>
                  <url>http://localhost:8081/nexus/content/repositories/cms-release/</url>
           </repository>
           <snapshotRepository>
                 <id>cms-snapshots</id>
                 <url>http://localhost:8081/nexus/content/repositories/cms-snapshots/</url>
                  </snapshotRepository>
</distributionManagement>

<6>localhost:8081/nexus配置自定义的工厂,设置权限,用户,角色,用户授权等,这样可以有效解决将项目

上传到自己的工厂中

 <7>注意问题:release版本和snapshots版本的区别

<8>在具体项目中配置从本地Nexus仓库下载jar包:

 <repositories>
        <repository>
        <id>nexus</id>
        <name>Nexus Repository</name>
        <url>http://localhost:8081/nexus/content/groups/public/</url>
        <releases>
          <enabled>true</enabled>
        </releases>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>
      </repository>
    </repositories>
<9>统一在settings.xml中配置所有项目都先从本地Nexus仓库中下载资源

<profile>

<id>nexusProfile</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>

<9>http://localhost:8081/nexus/content/groups/public地址指向多个资源仓库

 

<10>nexus更新本地索引:

 访问http://repo.maven.apache.org/maven2/.index/下载中心仓库最新版本的索引文件

nexus-maven-repository-index.gz和nexus-maven-repository-index.properties

indexer-cli-5.1.1.jar

在D:\nexus-2.12.0-01-bundle下新建nexus-index文件夹,将上面三个文件copy到该目录下

cd进入该目录下,执行下面命令

java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d D:\nexus-2.12.0-01-bundle\sonatype-work\nexus\indexer

重新启动nexus,即可更新索引