maven私有仓库nexus3.5搭建与使用

maven私有仓库nexus3.5搭建与使用

参考网址:
http://blog.csdn.net/clj198606061111/article/details/52200928
http://www.cnblogs.com/jingmoxukong/p/6050172.html
http://blog.csdn.net/north_eagle/article/details/42428219

环境
  • 操作系统 ubuntu16.04
  • nexus版本 nexus-3.5.0-02-unix
下载

下载地址:https://www.sonatype.com/download-oss-sonatype

安装
$ sudo tar -zxvf nexus-3.5.0-02-unix.tar.gz -C /usr/local/
$ vim ~/.bashrc
添加
#for nexus
export NEXUS_HOME=/uusr/local/nexus-3.5.0-02
export PATH=$NEXUS_HOME/bin:$PATH
$ source ~/.bashrc
$ nexus start

打开浏览器url http://localhost:8081 用户名admin具有全部权限,默认密码admin123。

配置maven

在$MAVEN_HOME/conf下修改settings.xml

 <pluginGroups>
    <pluginGroup>org.sonatype.plugins</pluginGroup>
  </pluginGroups>

 <servers>
    <server>
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>

<mirrors>
    <mirror>
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/repository/maven-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>

使用maven编译会首先从nexus私有仓库中下载依赖包,如果nexus私有仓库没有,会从配置的mirror中maven官方中央仓库central中下载,同时存入到nexus私有仓库。

仓库迁移

nexus2.x 到nexus 2.x迁移
直接拷贝仓库目录进行迁移
当前机器上 ${user.home}/sonatype-work copy到新机器的对应位置。这样所有的数据就可以全部恢复。

nexus2.x 到nexus 3.x迁移

配置nexus-2.x的Upgrade #

Administration–>Capabilities–>New–>Upgrade: Agent–>Access Token–>12345678

上面的流程是登陆nexus-2.x配置Upgrade:Agent和Access Token在此我们配置的是12345678

配置nexus-3.x的Upgrade #

Administration–>System–>Capabilities–>Create capability–>Create Upgrade Capability

通过Task迁移数据 #

Administration–>System–>Upgrade–>Next–>URL&access token–>Next…

URL: nexus2.x的url,例如 http://10.10.3.225:8082/nexus
Access Token: 12345678

数据迁移完毕,验证仓库数据。

nexus3.x 到nexus 3.x迁移
暂时未找到方法,采用直接拷贝仓库目录进行迁移,maven编译时会有一些警告信息,并且有些包无法下载。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值