Jenkins DSL Pipeline插件groovy.lang.MissingMethodException:没有方法签名:script.pipelineJob()

时间:2016-12-23 10:27:47

标签: jenkins-pipeline jenkins-job-dsl

对于我的本地/调试测试,我已生成xml步骤。我不想添加插件Pipeline Plugin,但我无法弄清楚它是哪个依赖项,或者我是否有错误的类路径,或者?

我的代码

 import javaposse.jobdsl.dsl.DslFactory
 import javaposse.jobdsl.dsl.jobs.WorkflowJob

 pipeline = dslFactory.pipelineJob(name)

导致这种说法

    Caused by: groovy.lang.MissingMethodException: No signature of method: script.pipelineJob() is applicable for argument types: (java.lang.String) values: [ps-landing-pipeline]

我的家属(build.gradle)

dependencies {
    compile 'org.codehaus.groovy:groovy:2.1.3'
    compile 'org.jenkins-ci.plugins:job-dsl-core:1.45'
    compile 'org.jenkins-ci.plugins.workflow:workflow-aggregator:2.4'
    testCompile('org.spockframework:spock-core:0.7-groovy-2.0') {
        exclude module: 'groovy-all'
    }
    // for the RestApiScriptRunner and XmlOutputRunner
    compile('ant:ant:1.7.0')
}

1 个答案:

答案 0 :(得分:0)

我发现问题出在哪里,我的dsl-core版本很差

compile 'org.jenkins-ci.plugins:job-dsl-core:1.45'

VS

compile 'org.jenkins-ci.plugins:job-dsl-core:1.47'

- >我需要在API查看器中找到哪个版本:https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.DslFactory.pipelineJob

enter image description here