我嘗試使用CopyArtifacts()以及編寫用於從上游構建中複製工件的自定義配置塊。我得到了兩個錯誤,如下圖所示 -CopyArtifacts(...)在Jenkins的job-dsl-plugin中使用時發生錯誤
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/**, [email protected]]
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/**, [email protected]]
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)
我的代碼片段如下 -
CopyArtifacts(downstreamUnityJob.name,'target/**'){
buildNumber("${UNITY_BUILD_NUMBER}")
}
當我嘗試自定義配置塊,我得到的錯誤,以及 -
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)
這裏是我的配置塊 -
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"
}
}
}
你能讓我知道我錯過了什麼嗎?
感謝。這是一個錯字。即使在修復之後,我也有類似的問題。後來我發現了這個問題。 copyArtifacts(...)調用需要在步驟{...} – b0s0nparticle88
@ b0s0nparticle88下:如果您發現問題,請自行回答並標記回答 –