Hi all,
I have JDK and Maven tools installed in my Jenkins global configuration. So, I could use the command exactly as provided in
this tutorial.
def mvnHome = tool 'Default Maven'
However, I'm getting the following exception because of another tool I have installed in there:
java.lang.ClassCastException: custom.jenkins.bw.BWInstallation$DescriptorImpl cannot be cast to hudson.tools.ToolDescriptor
at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:119)
at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:109)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:137)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
at WorkflowScript.run(WorkflowScript:3)
at Unknown.Unknown(Unknown)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:100)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:76)
at sun.reflect.GeneratedMethodAccessor508.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
The tool in question is a custom implementation, a bit old but still used. My job isn't interested in this custom tool at all, but I cannot simply removed it from there because other jobs (not using Workflow) still depend on it.
I believe the custom tool isn't compliant with the Workflow plugin. Just in case, below is the signature of the Descriptor of our custom tool:
@Extension
public static class DescriptorImpl extends Descriptor<ToolInstallation> {
Shouldn't the Workflow plugin simply ignore tools which aren't compliant with it instead of raising such exceptions? Is there any workaround for it?