Reputation: 31
I tried using the CopyArtifacts() as well as writing a custom configure block for copying artifacts from upstream build. I get the errors in both as shown below -
FATAL: No signature of method: javaposse.jobdsl.dsl.Job.CopyArtifacts() is applicable for argument types: (java.lang.String, java.lang.String, jobDSL$_run_closure1_closure4_closure14) values: [xxx-StarTrooper-master.unity, target/**, jobDSL$_run_closure1_closure4_closure14@a1994b]
groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.Job.CopyArtifacts() is applicable for argument types: (java.lang.String, java.lang.String, jobDSL$_run_closure1_closure4_closure14) values: [xxx-StarTrooper-master.unity, target/**, jobDSL$_run_closure1_closure4_closure14@a1994b]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at jobDSL$_run_closure1_closure4.doCall(jobDSL.groovy:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
My code snippet is as below -
CopyArtifacts(downstreamUnityJob.name,'target/**'){
buildNumber("${UNITY_BUILD_NUMBER}")
}
When I try a custom configure block I get error as well -
FATAL: No signature of method: groovy.util.Node.call() is applicable for argument types: (java.lang.String) values: [xxx-StarTrooper-master.unity]
Possible solutions: wait(), name(), value(), any(), wait(long), get(java.lang.String)
groovy.lang.MissingMethodException: No signature of method: groovy.util.Node.call() is applicable for argument types: (java.lang.String) values: [xxx-StarTrooper-master.unity]
Possible solutions: wait(), name(), value(), any(), wait(long), get(java.lang.String)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at jobDSL$_run_closure1_closure4_closure14_closure16.doCall(jobDSL.groovy:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
and here is my configure block -
configure {
project -> project/ builders / 'hudson.plugins.copyartifact.CopyArtifact'{
projectName downstreamUnityJob.name //downstreamUnityJob comes from another job dsl object
project downstreamUnityJob.name
filter 'target/**'
selector('class':"hudson.plugins.copyartifact.SpecificBuild"){
buildNumber "$UNITY_BUILD_NUMBER"
}
}
}
Can you let me know what am I missing?
Upvotes: 3
Views: 2652
Reputation: 326
In the JobDsl, copyArtifacts needs to start with a lower case c (not upper case C as you have it)
See here Job dsl wiki and StepContext.copyArtifacts
Upvotes: 2
Reputation: 307
For your issue, you should use the delegate
attribute.
Your element might have a conflict with an other one.
Here is an example :
configure { project ->
project / builders << 'hudson.plugins.copyartifact.CopyArtifact' {
delegate.project 'BLABLA' // DELEGATE
...
}
Upvotes: 0
Reputation: 403
Ah, I ran into the same issue.
configure { project ->
project / builders << 'hudson.plugins.copyartifact.CopyArtifact' {
project(value.deps.get(0))
filter(value.ins)
target('')
buildChooser(class: 'hudson.plugins.copyartifact.SpecificBuildSelector') {
buildNumber('${parentBuildNo}')
}
doNotFingerprintArtifacts(true)
}
}
resulted in a FATAL: No signature of method: groovy.util.Node.call()
for me.
I solved it by changing the name of the XML element being modified from project
to myProject
. Since the project
modifier in the configure block shadows the name of the element you are modifying, it's necessary to use a different name for the closure argument.
configure { myProject ->
myProject / builders << 'hudson.plugins.copyartifact.CopyArtifact' {
project(value.deps.get(0))
filter(value.ins)
target('')
buildChooser(class: 'hudson.plugins.copyartifact.SpecificBuildSelector') {
buildNumber('${parentBuildNo}')
}
doNotFingerprintArtifacts(true)
}
}
Success!
Upvotes: 0