简体   繁体   English

在 jenkins 管道中集成 maven、artifactory 的问题

[英]Issue in integrating maven, artifactory in jenkins pipeline

Plz find my code请找到我的代码

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
}
}

I am using the official sample on artifactory site https://github.com/jfrog/project-examples/blob/master/jenkins-examples/pipeline-examples/scripted-examples/maven-example/Jenkinsfile我正在使用 artifactory 站点上的官方示例https://github.com/jfrog/project-examples/blob/master/jenkins-examples/pipeline-examples/scripted-examples/maven-example/Jenkinsfile

Jobs console output enter image description here作业控制台输出在此处输入图像描述

Unable to move beyond "[Pipeline] artifactoryMavenBuild (hide)"无法超越“[Pipeline] artifactoryMavenBuild (hide)”

Plz help me out here...请帮我在这里...

I am able to integrate maven, artifactory in simple Maven project item but not in pipeline item on jenkins....我能够在简单的 Maven 项目项中集成 maven、artifactory,但不能在 jenkins 的管道项中集成....

I had some similar issue and I switched to basics.我有一些类似的问题,我切换到基础知识。 If you are using jfrog(which you should) you can simply use the API( https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API ) and hit it with curl, eg:如果您使用的是 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 curl -u ${username}>:${password}@ -X PUT \\"${mavenRepo}/${relativeMavenPath}/${serviceName}/${serviceTag}/${serviceName}-${serviceTag}.jar \\" -T ${your-jar-name}.jar

Run this command in the directory where your jar exists.在 jar 所在的目录中运行此命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM