centos+nexus+maven私有仓储

nexus 学习记录过程。笔者也是刚起步,来记录下学习过程。

一、下载

1.下载地址

https://help.sonatype.com/repomanager3/download

右击复制链接

到我们centos指定的目录下wget

wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz

解压压缩包

tar -zxvf nexus-3.14.0-04-unix.tar.gz

进入包下的bin目录,并后台启动。

/usr/local/nexus-3.14.0-04/bin
./nexus start

./nexus start为后台启动命令

./nexus stop为定制后台服务

./nexus status查看后台nexus服务状态

./nexus restart重启后台nexus服务

注:默认端口为8081,在/usr/local/nexus-3.14.0-04/etc/nexus-default.properties中可修改配置,一般修改端口,此例不改配置了。

二:配置私有仓储

这是可以访问我们的nexus,url为ip:8081

默认的帐号密码为:admin;admin123

sign in之后就出现了配置页面,可以创建仓储。

本次中不创建新的仓储,安装完默认有maven仓储,可以使用。接下来我们设置配置,在本地maven的setting.xml配置。

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://ip:8081/repository/qc-test/</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <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>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
  <servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>

在IDEA maven的pom.xml中配置

<distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>Releases</name>
            <url>http://xx.xx.xx.xx:8081/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <name>Snapshot</name>
            <url>http://xx.xx.xx.xx:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
</distributionManagement>

现在配置完成,

在我们的IDEA运行命令

mvn clean package

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值