Reputation: 599
I'm trying to publish to an Artifactory (v4.5.1) instance using a Jenkins(v2.7) pipeline. An excerpt from my script is below. Problem seems to be that the "Artifactory" object is not recognized and is treated as a string. Can someone suggest what the problem might be?
node {
//error - "Artifactory" treated as String
def server = Artifactory.server SERVER_ID
def uploadSpec = """{
"files": [
{
"pattern": "hello-pipeline/build/libs/*.jar",
"target": "jenkins-local"
}
]
}"""
def buildInfo1 = server.upload spec: uploadSpec
}
Upvotes: 2
Views: 10855
Reputation: 2343
I've had success with the syntax:
node {
def server = Artifactory.server SERVER_ID
def uploadSpec = """{
"files": [{
"pattern": "hello-pipeline/build/libs/*.jar",
"target": "jenkins-local"
}
]
}"""
server.upload(uploadSpec)
}
as was suggested on another question. However, this could be an issue with your version, as mention in the the comment above.
Upvotes: 2