2
votes

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

Jobs console output enter image description here

Unable to move beyond "[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....

1

1 Answers

1
votes

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:

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.