好享购物官方网站购物,wordpress站点信息修改版权,建设网站建站,东营兴通建设工程公司网站目录
一、实验
1.Jenkins配置制品上传流水线
二、问题
1.上传制品显示名称有误 一、实验
1.Jenkins配置制品上传流水线
(1) 新建流水线项目 #xff08;2#xff09;描述
#xff08;3#xff09;添加参数 #xff08;4#xff09;查看构建首页 #xff08;52描述
3添加参数 4查看构建首页 5编辑流水线
Library(mylibmaster) _
import org.devops.*def checkout new Checkout()
def build new Build()
def unittest new UnitTest()
def sonar new Sonar()pipeline {agent { label build}options {skipDefaultCheckout true}stages{stage(Checkout){steps{script {println(GetCode)checkout.GetCode(${env.srcUrl},${env.branchName})}}}stage(build){steps{script{println(Build)sh mvn clean package}}}stage(UnitTest){steps{script{println(Test)unittest.CodeTest(${env.buildTool})}}}stage(Upload){steps{script{NexusUploadByPlugin(${env.artifactId},target/maven-test-1.0-SNAPSHOT.jar,${env.type},${env.groupId},${env.version})}}}}
}//NexusUploadByPlugin(devops-test,target/maven-test-1.0-SNAPSHOT.jar,jar,com.jenkins,1.1.2)def NexusUploadByPlugin(artifactId,file,type,groupId,version ){nexusArtifactUploader artifacts: [[artifactId: artifactId,classifier: ,file: file,type: type]],credentialsId: 318df1ad-083b-4158-ac88-2f584446563e,groupId: groupId,nexusUrl: 192.168.204.13:8081,nexusVersion: nexus3,protocol: http,repository: mymavenrepo,version: version
} 6开始构建
7Blue Ocean查看 8查看日志 9Nexus查看 二、问题
1.上传制品显示名称有误
1报错 2原因分析
代码引用错误使用了单引号
3解决方法
修改代码使用双引号
修改前
script{NexusUploadByPlugin(${env.artifactId},target/maven-test-1.0-SNAPSHOT.jar,${env.type},${env.groupId},${env.version})}
修改后
script{NexusUploadByPlugin(${env.artifactId},target/maven-test-1.0-SNAPSHOT.jar,${env.type},${env.groupId},${env.version})}