centos 安装配置 nexus maven私有仓库

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

unzip nexus-2.11.1-01-bundle.zip

cd nexus-2.11.1-01/bin/

vi nexus

#将  #RUN_AS_USER=  改为

RUN_AS_USER=root

#启动

./nexus start

#访问IP:8081/nexus

#配置开机启动

vi /etc/xinetd.d/nexus

#最后增加

/opt/nexus-2.11.1-01/bin/nexus start

vi /etc/rc.d/rc.local

#增加

/opt/nexus-2.11.1-01/bin/nexus start


访问IP:8081/nexus

1.新建两个hosted仓库myRelease和mySnapshot


2.针对以上两个仓库配置权限Privileges


3.配置角色role,

   myReleaseRole 用来发布,赋给myRelease和mySnapshot的所有权限

   mySnapshotRole 用来发布,赋给mySnapshot的所有权限,和myRelease的view和read权限


4.配置用户

配置一个开发用户 devaccount,赋予mySnapshotRole角色

配置一个部署用户 releaseaccount,赋予myReleaseRole角色


在客户端上配置maven

5.配置apache-maven-3.2.2\conf\setting.xml

在mirrors节点增加

       <mirror>
        <id>my-public</id>  
        <name>internal nexus repository</name>
        <url>http://IP:8081/nexus/content/groups/public/</url>  
        <mirrorOf>central</mirrorOf>
      </mirror>


在servers节点增加以上的两个帐号的一个

    <server>
      <id>releases-my</id>
      <username>releaseaccount</username>
      <password>111111</password>
    </server>
   
    <server>
      <id>snapshots-my</id>
      <username>devaccount</username>
      <password>111111</password>
    </server>


6.在项目的顶级pom.xml中的project节点下增加
<distributionManagement>
<snapshotRepository>
<id>snapshots-guangduo</id>
<name>Snapshots</name>
<url>http://192.168.1.34:8081/nexus/content/repositories/gd_Snapshot/</url>
</snapshotRepository>
<repository>
<id>releases-guangduo</id>
<name>Releases</name>
<url>http://192.168.1.34:8081/nexus/content/repositories/gd_Release/</url>
</repository>
</distributionManagement>

7.用命令行在项目pom.xml所在目录执行 mvn deploy


8.禁用匿名用户anonymous


/opt/nexus-2.11.1-01/bin/nexus stop

到http://repo.maven.apache.org/maven2/.index/ 下载 nexus-maven-repository-index.gz 和 nexus-maven-repository-index.properties

复制nexus-maven-repository-index.properties到sonatype-work/nexus/indexer/central-ctx

复制indexer-cli-5.1.1.jar  和 nexus-maven-repository-index.gz 到sonatype-work/nexus/indexer/

在sonatype-work/nexus/indexer/执行

java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d central-ctx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值