安装
- 下载镜像
docker pull registry.cn-hangzhou.aliyuncs.com/sherry/nexus:3.13.0
- 设置数据卷
docker volume create --name nexus-data
- 启动
docker run -d -p 8080:8081 --name nexus -v \
nexus-data:/nexus-data \
registry.cn-hangzhou.aliyuncs.com/sherry/nexus:3.13.0
启动nexus镜像,并将数据挂载到数据卷中
- 登陆
默认登陆名密码:admin/admin123
使用nexus私有仓库
修改默认密码
创建一个新仓库
这里创建了一个以阿里云镜像为中心的仓库
基本使用
- 怎么使用私服的仓库呢?
修改setting.xml
...
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
...
<mirrors>
<mirror>
<id>nexus</id>
<name>Nexus私有仓库</name>
<url>http://server4:8080/repository/maven-public/</url>
</mirror>
</mirrors>
...
这里只需要配置一个mirror
节点,就可以使用我们的nexus仓库了,server节点用于jar的上传
上传项目jar
在pom.xml中添加以下配置
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://localhost:8082/repository/maven-thiird/</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://localhost:8082/repository/maven-thiird/</url>
<releases>
<enabled>true</enabled>
</releases>
<!--snapshots默认是关闭的,需要开启 -->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin> <!-- 打jar包 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
上传第三方jar
手动上传第三方jar,如oracle驱动