Linux服务器使用六:搭建自己的Sonatype Nexus Maven私有库

一、安装Sonatype Nexus

1、下载最新版的Sonatype Nexus并上传到linux服务器
2、拷贝并解压

cp nexus-latest-bundle.tar.gz /home/dfz/
mkdir nexus
tar -zxvf nexus-latest-bundle.tar.gz -C nexus

3、编辑nexus脚本,配置参数

vi /home/dfz/nexus/nexus-2.14.1-01/bin/nexus
#配置以下内容
RUN_AS_USER=root

4、启动nexus服务

./nexus start

访问http://Your-IP:8081/nexus/
即可进入管理页面
这里写图片描述

默认账户为:admin,默认密码为:admin123

二、Maven端配置

1、在本地库的配置文件setting.xml中加入以下配置:

      <server>
        <!-- 部署账户密码 -->
        <id>nexus-releases</id>
        <username>deployment</username>
        <password>deployment123</password>
      </server>

      <server>
        <!-- 部署账户密码 -->
        <id>nexus-snapshots</id>
        <username>deployment</username>
        <password>deployment123</password>
      </server>

      <profile>
        <id>dfz</id>

        <activation>
            <activeByDefault>false</activeByDefault>
          <jdk>1.7</jdk>
        </activation>
        <!-- 配置私有库 -->
        <repositories>
          <repository>
            <id>nexus</id>
            <url>http://10.0.0.111:8081/nexus/content/groups/public/</url>
            <releases>
                <enable>true</enable>
            </releases>
            <snapshots>
                <enable>true</enable>
            </snapshots>
          </repository>
        </repositories>
        <!-- 配置插件库 -->
        <pluginRepositories>
          <pluginRepository>
            <id>nexus</id>
            <url>http://10.0.0.111:8081/nexus/content/groups/public/</url>
            <releases>
                <enable>true</enable>
            </releases>
            <snapshots>
                <enable>true</enable>
            </snapshots>
          </pluginRepository>
        </pluginRepositories>

      </profile>
      <activeProfiles>
        <activeProfile>dfz</activeProfile>
      </activeProfiles>

2、在项目的pom.xml文件中加入

<distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <name>Nexus Release Repository</name>
            <url>http://10.0.0.111:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <name>Nexus SnapShot Repository</name>
            <url>http://10.0.0.111:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

完成私有库搭建

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值