部署nexus3.x私服

依赖软件

JDK,Maven

下载nexus

下载: https://help.sonatype.com/repomanager3/product-information/download

解压:

tar zxvf nexus-3.38.1-01-unix.tar.gz

添加用户授权

添加用户

nexus/nexus

chown -R nexus /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64
chown -R nexus /usr/local/src/nexus/nexus
chown -R nexus /usr/local/src/nexus/sonatype-work

启动

修改nexus.vmoptions占用内存

启动/停止

./nexus start
./nexus run

阿里云端口范围/关闭防火墙

在这里插入图片描述

登录/默认登录密码

http://ip:8081

默认登录账号:admin
默认密码: cd /sonatype-work/nexus3/admin.password

maven的settings文件配置和项目pom推送仓库配置

// 设置一个中心仓库或多个
<mirror>    
    <id>nexus</id>    
    <mirrorOf>central</mirrorOf>      // 中央仓库的映射
    <name>nexus mirror.</name>
    <url>http://192.168.20.72:8080/content/groups/public</url>
</mirror>

<mirrorOf>central</mirrorOf>里是要替代的仓库的id,这里就是会代替central的。如果填*,就会替代所有仓库。


这个在pom.xml、setting.xml都可以配置,引用级别是从pom > setting
<repositories>
    <repository>
        <id>nexus</id>
        <name>nexus</name>
        <url>http://192.168.1.103:8081/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>


<pluginRepositories>
    <pluginRepository>
        <id>nexus</id>
        <name>nexus</name>
        <url>http://192.168.1.103:8081/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>


<profile>
    <id>Nexus</id>   // 定义一个profiles
    <repositories>
        <repository>   // 定义一个远程仓库
        <id>nexus</id>
        <url>http://localhost:8081/repository/maven-public/</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>     // 定义一个插件仓库
        <id>nexus</id>
        <url>http://localhost:8081/repository/maven-public/</url>
        <releases>
        <enabled>true</enabled>
        </releases>
        <snapshots>
        <enabled>true</enabled>
        </snapshots>
        </pluginRepository>
    </pluginRepositories>
    </profile>
</profiles>
<!-- 激活 -->
<activeProfiles>      // 激活
<activeProfile>Nexus</activeProfile>
</activeProfiles>

项目中pom配置:

<distributionManagement>
    <repository>
        <id>nexus-release</id>
        <name>Nexus Release Repository</name>
        <url>http://192.168.20.72:8080/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>nexus-snapshots</id>
        <name>Nexus Snapshots Repository</name>
        <url>http://192.168.20.72:8080/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

gzh-程序员灿灿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值