nexus 私服 的下载jar包和上传jar包
从nexus私服下载jar包
1. 修改maven的settings.xml文件
<mirrors> <mirror> <!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central 等和仓库配置 id 一致的内容 --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/nexus/content/groups/public/</url> </mirror> </mirrors> |
其他镜像:
阿里镜像:
<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> |
往nexus私服上传jar包
1. 在需要上传的项目配置
pom.xml:
<!-- 构建部署项目 --> <distributionManagement> <repository> <id>releases</id> <name>Internal Releases</name> <url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Internal Snapshots</name> <url>http://localhost:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> |
2. 在maven的setting.xml文件配置
<servers> <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>deployment</username> <password>deployment123</password> </server> </servers> |
3. 使用deploy命令进行上传
注意: 项目的版本是snapshot,自动上传snapshot目录,如果release,自动上传到release目录。