Reputation: 563
I have Jenkinsfile
written in groovy
as follows:
env.MVN_Goals = MVN_Goals
node {
// Get Artifactory server instance, defined in the Artifactory Plugin administration page.
def server = Artifactory.newServer url: 'http://localhost:8085/artifactory', username: 'admin', password: 'password'
// Create an Artifactory Maven instance.
def rtMaven = Artifactory.newMavenBuild()
stage ('Clone sources'){
git url: 'D:/Sample GIT_Maven Repo'
}
stage 'Artifactory configuration'
rtMaven.deployer releaseRepo:'libs-release-local', snapshotRepo:'libs-snapshot-local', server: server
rtMaven.resolver releaseRepo:'libs-release', snapshotRepo:'libs-snapshot', server: server
def buildInfo = Artifactory.newBuildInfo()
stage('Maven_Build'){
if (isUnix()) {
sh "D:/apache-maven-3.3.9/bin/mvn -B -Dmaven ${MVN_Goals}"
}
else{
bat "D:/apache-maven-3.3.9/bin/mvn -B -Dmaven ${MVN_Goals}"
}
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true])
}
stage ('Publish build info'){
server.publishBuildInfo buildInfo
}
}
I tried configuring the Artifactory in Jenkins by adding the Artifactory plugin for Jenkins. When I tried to test the connection, I am getting an error as There is either an incompatible or no instance of Artifactory at the provided URL
. The same error is occurring when i tried to build my job in Jenkins. Is there a way to resolve it?
Artifactory plugin version - 2.9.1
Artifactory Version - 4.15.0
Upvotes: 1
Views: 2597
Reputation: 71
def buildInfo = Artifactory.newBuildInfo()
is within that particular stage.
Modify that as
env.MVN_Goals = MVN_Goals
node {
// Get Artifactory server instance,
// defined in the Artifactory Plugin administration page.
def server = Artifactory.newServer url: 'http://localhost:8085/artifactory', username: 'admin', password: 'password'
// Create an Artifactory Maven instance.
def rtMaven = Artifactory.newMavenBuild()
def buildInfo = Artifactory.newBuildInfo()
stage ('Clone sources'){
git url: 'D:/Sample GIT_Maven Repo'
}
Upvotes: 2