在詹金斯管道中集成Maven和工件的问题

时间:2019-02-03 13:08:35

标签: maven jenkins jenkins-pipeline artifactory

请找到我的代码

node {
// Get Artifactory server instance, defined in the Artifactory Plugin administration page.
def server = Artifactory.server "Artifactory"
// Create an Artifactory Maven instance.
def rtMaven = Artifactory.newMavenBuild()
def buildInfo

stage('Clone sources') {
    git url: 'https://github.com/jfrogdev/project-examples.git'
}

stage('Artifactory configuration') {
    // Tool name from Jenkins configuration
    rtMaven.tool = "Maven"
    // Set Artifactory repositories for dependencies resolution and artifacts deployment.
    rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-release-local', server: server
    rtMaven.resolver releaseRepo: 'libs-release', snapshotRepo: 'libs-release', server: server

}

stage('Maven build') {
    buildInfo = rtMaven.run pom: 'maven-example/pom.xml', goals: 'clean package'
}

stage('Publish build info') {
    server.publishBuildInfo buildInfo
}
}

我正在人工制品站点上使用官方样品 https://github.com/jfrog/project-examples/blob/master/jenkins-examples/pipeline-examples/scripted-examples/maven-example/Jenkinsfile

作业控制台输出 enter image description here

无法超越 “ [Pipeline] artifactoryMavenBuild(隐藏)”

请帮助我在这里...

我能够将Maven,人工制品集成到简单的Maven项目中,但不能集成到jenkins的管道项目中。...

1 个答案:

答案 0 :(得分:1)

我遇到了类似的问题,因此我改用了基础知识。如果您正在使用jfrog(应该这样做),则可以简单地使用API​​(https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API)并用curl使其击中,例如:

curl -u $ {username}>:$ {password} @ -X PUT \“ $ {mavenRepo} / $ {relativeMavenPath} / $ {serviceName} / $ {serviceTag} / $ {serviceName}-$ {serviceTag } .jar \“ -T $ {your-jar-name} .jar

在jar所在的目录中运行此命令。