使用Docker搭建Maven私有仓库Nexus私服

docker search nexus
检索 nexus

下载nexus镜像
docker pull docker.io/sonatype/nexus3

确保目录名称存在,不存在创建目录
mkdir -p /data/nexus/data
授权
chmod 777 -R /data/nexus/data
启动nexus
docker run -d -p 8081:8081 --name nexus --privileged=true -v /data/nexus/data:/nexus-data sonatype/nexus3

查看日志 表示成功
在这里插入图片描述
首次登录 需要查看密码
找到密码
cat /data/nexus/data/admin.password

修改密码 为禁用匿名
在这里插入图片描述
启动访问 出现连接异常

登录进去选择第3个 禁用 重启
在这里插入图片描述
在这里插入图片描述
配置从阿里云 maven库里面拉依赖
http://maven.aliyun.com/nexus/content/groups/public
在这里插入图片描述

配置打包到nexus私服中
maven setting.xml配置
在这里插入图片描述
username password 则为nexus登录的账号密码

   <repositories>
    <repository>
        <id>nexus</id>
        <name>Nexus Repository</name>
        <url>http://192.168.1.6:8081/repository/public/</url>
    </repository>
</repositories>
<!-- 配置远程发布到私服,mvn deploy -->
<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://192.168.1.6:8081/repository/releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://192.168.1.6:8081/repository/snapshots/</url>
    </snapshotRepository>
</distributionManagement>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值