一:将jar发送到nexus私服务器
1.pom.xml文件添加配置
pom.xml文件中的这个版本标签对应结尾的(RELEASE、SNAPSHOT)将决定分配到私服的那个仓库1.0.0-RELEASE
releases
http://116.62.106.24:8081/repository/boris-release/
snapshots
http://116.62.106.24:8081/repository/boris-snapshot/
2.maven settings.xml文件添加配置
releases
boris-test-nexus-repository
boris
snapshots
boris-test-nexus-repository
boris
然后执行命令:mvn deploy,就成功部署到私服环境了,如下是我测试的一个结果
PS:还有一种上传jar包的方式,就是直接去nexus管理界面手动上传
二:从nexus私服下载第三方jar包(有两种方式)
1.方式一(pom.xml的方式)
maven-nexus-group
http://116.62.106.24:8081/repository/boris-group/
true
true
maven-nexus-group
http://116.62.106.24:8081/repository/boris-group/
true
true
由于nexus私服需要有用户名和密码登录才能访问,需要在maven settings.xml文件中配置,加入如下内容
maven-nexus-group
boris-test-nexus-repository
boris
注意上面的server->id的值和pom.xml中repository->id的值一致,通过这个id关联找到凭证的。
2.方式二(镜像方式)
maven settings.xml文件中配置
maven-nexus-group
boris-test-nexus-repository
boris
maven-nexus-group1
*central
nexus boris images
http://116.62.106.24:8081/repository/boris-group/
注意上面的server->id的值和mirror->id的值需要一致,这样才能找到对应的凭证。
区别:方式一只针对单个项目有效,方式二针对所有项目有效