Jenkins pipeline NoSuchMethodError (copyArtifacts)

Viewed 430

this question in some forms has already been asked, but all questions/answers I found did not help me in my case :(

I have the following Jenkinsfile

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                script {
                    copyArtifacts projectName: 'producer', selector: specific('lastCompleted'), filter:'*.json'
                }
            }
        }
    }
}

to copy an aritfact from another job. This fails with java.lang.NoSuchMethodError: No such DSL method 'specific' found among steps.

Can anyone spot, why this is occurring? As far as I can see, I do not mix the declarative vs scripted form... I understand that it tries to find selector not for copyArtifacts, but for script, right ?

But how to make this correct ?

Thanks

1 Answers
Related