一、Nexus Repository Manager Publisher
1.1 安装Nexus Repository Manager插件
- 离线下载安装
Jenkins dashboard, navigate to Manage Jenkins -> Plugin Manager, proceed to the Advanced tab, and upload the downloaded HPI using the Upload Plugin form shown below
- 在线安装
直接搜索 nexus
1.2 配置 jenkins
next thing you need to do is configure a Nexus Repository Manager to be able to upload your build artifacts.
Once again click on the Manage Jenkins
link from the dashboard and then the Configure System
link.
Under the Sonatype Nexus heading select Nexus Repository Manager 2.x Server or 3.x
from the Add Nexus Repository Manager Server dropdown
- nexus3
- nexus2 ,注意2的地址参数
1.3 添加凭证
In this step, we should add a Jenkins Crendential of kind "Username with password" with a valid login to our Nexus instance and let's give it an Id of "nexus-credentials."
密码最好和oss中的密码一样
1.4 Tool Configuration (Optional)
- Manage Jenkins -> Global Tool Configuration
二、配置Nexus Oss
2.1 Create a Hosted Repository in Nexus
- we are creating a hosted repository named "repository-example"
- Deployment policy: allow redeploy
- Storage: default.
- nexus2 配置
2.2 Create a Valid User in Nexus OSS
- nexus2 用户创建
案例
nexus3
version 随意定义跟pom没有关系
以xxx.war or xxx.jar 为准
- 上传到oss效果
nexus2
- 配置jenkins
- 配置Jenkins中 nexus2x
- 创建jenkins maven 项目工程
package -DskipTests=true clean package
- 配置项目工程中nexus manager
- 配置Version变量
channel stopped
Uploading Maven asset with groupId: com.tmrm artifactId: tmrm-message version: $Version To repository: prod-Releases
Successfully Uploaded Maven Assets
Finished: SUCCESS
channel stopped
Uploading Maven asset with groupId: com.tmrm artifactId: tmrm-message version: $Version To repository: prod-Releases
Successfully Uploaded Maven Assets
Finished: SUCCESS
- 效果图