Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when running gradle with repoScm #94

Open
sithiksm opened this issue Jan 31, 2018 · 0 comments
Open

Failure when running gradle with repoScm #94

sithiksm opened this issue Jan 31, 2018 · 0 comments

Comments

@sithiksm
Copy link

sithiksm commented Jan 31, 2018

Hi,
I try to create pipelinejob with repoScm, actual job creation works fine and job is created but job-dsl-scripts review fails with below error in gradle. Can anyone help to figure out te rootcause of this issue?

def addOSPipelineFromrepoSCM(def context,
script_path) {
context.definition {
cpsScm {
scriptPath(script_path)
scm {
repoScm {
manifestBranch('master')
manifestRepositoryUrl('')
manifestFile('default.xml')
}
}
}
}
}

Error info:

Exception in thread "main" javaposse.jobdsl.dsl.DslScriptException: (os_pfm6_dsl.groovy, line 78) No signature of method: javaposse.jobdsl.dsl.helpers.ScmContext.repoScm() is applicable for argument types: (os_pfm6_dsl$_run_closure1$_closure11$_closure12$_closure13$_closure14) values: [os_pfm6_dsl$_run_closure1$_closure11$_closure12$_closure13$_closure14@1349883]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:255)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScriptEngine(AbstractDslScriptLoader.groovy:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader$_runScripts_closure1.doCall(AbstractDslScriptLoader.groovy:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScripts(AbstractDslScriptLoader.groovy:46)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader$runScripts.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at javaposse.jobdsl.Run$_main_closure2.doCall(Run.groovy:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1890)
at org.codehaus.groovy.runtime.dgm$159.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at javaposse.jobdsl.Run.main(Run.groovy:41)
Caused by: groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.helpers.ScmContext.repoScm() is applicable for argument types: (os_pfm6_dsl$_run_closure1$_closure11$_closure12$_closure13$_closure14) values: [os_pfm6_dsl$_run_closure1$_closure11$_closure12$_closure13$_closure14@1349883]

My build.gradle looks like:

apply plugin: 'groovy'
apply plugin: 'application'

repositories {
mavenCentral()
maven { url('http://repo.jenkins-ci.org/releases/') }
}

configurations {
testPlugins {}
}

sourceSets {
jobs {
}
}

task copyJobs(type: Copy) {
from 'src/jobs/groovy'
include '*.groovy'
into "$project.buildDir/jobs"
}

task copyResources(type: Copy) {
from 'src/jobs/resources'
into "$project.buildDir/jobs/src/jobs/resources"
}

task buildXml {
}

fileTree(dir: "${project.projectDir}/src/jobs/groovy", include: '**/*.groovy').each { file ->

def baseName = file.name[0..file.name.lastIndexOf('.') - 1]
def output = new File(project.buildDir, baseName)

def buildSingleXml = tasks.create(name: "build${baseName.capitalize()}Xml", type: JavaExec) {
    main = 'javaposse.jobdsl.Run'
    mainClassName = main
    classpath = sourceSets.main.runtimeClasspath
    args "${project.buildDir}/jobs/${file.name}"
    workingDir "$project.buildDir/jobs"
}

buildSingleXml.doFirst {
    output.mkdirs()
}

buildSingleXml.dependsOn copyResources
buildSingleXml.dependsOn copyJobs

buildSingleXml.inputs.file file
buildSingleXml.outputs.dir output

buildXml.dependsOn buildSingleXml

}

dependencies {
compile "org.codehaus.groovy:groovy-all:2.4.8"
compile "org.jenkins-ci.plugins:job-dsl:${project.ext.jobDslVersion}@jar"
compile "org.jenkins-ci.plugins:job-dsl-core:${project.ext.jobDslVersion}"
compile "org.jenkins-ci.plugins:gradle:${project.ext.gradlePluginVersion}@jar"
compile "org.jenkins-ci.plugins:git:3.6.3@jar"
compile "org.jenkins-ci.plugins:repo:1.10.7@jar"
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.0-groovy-2.4'
testPlugins "org.jenkins-ci.plugins:repo:1.10.7"
testPlugins "org.jenkins-ci.plugins:git:3.6.3"
testPlugins "org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.7"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant