-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins 2.277.3
Use of extended method with in Groovy result in a groovy.lang.MissingMethodException.
This code portion work well in pure groovy not in a grovvy pipeline :
HttpURLConnection connection = baseUrl.openConnection() as HttpURLConnection connection.with { setDoOutput(true) setRequestProperty('Content-Type', 'application/json') setRequestProperty('Authorization', httpUtils.getBasicAuthString(Credentials.JENKINS_ARTIFACTORY_TOKEN.value)) requestMethod = 'POST' outputStream.withWriter { writer -> writer << queryString } assert responseCode == 200 }
Result in the exception :
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: fr.hm.pichm.tools.publication.ArtifactoryPromote.setDoOutput() is applicable for argument types: (java.lang.Boolean) values: [true] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)