I have defined a shared library in Jenkins:
import com.codependent.jenkins.pipelines.Utils
def call(List<String> mavenGoals){
def processedMavenGoals = mavenGoals.join ' '
pipeline {
agent any
...
}
If i call this from my project's Jenkinsfile like this it works ok:
#!groovy
@Library('jenkins-pipeline-shared-library-example') _
buildPipeline(['clean', 'install'])
However if I omit the parethesis as Groovy syntax allows:
#!groovy
@Library('jenkins-pipeline-shared-library-example') _
buildPipeline ['clean', 'install']
The execution shows the folloing exception. Why?
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified getAt method buildPipeline[java.util.ArrayList]
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetArray(SandboxInterceptor.java:451)
at org.kohsuke.groovy.sandbox.impl.Checker$10.call(Checker.java:413)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetArray(Checker.java:418)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getArray(SandboxInvoker.java:45)
at com.cloudbees.groovy.cps.impl.ArrayAccessBlock.rawGet(ArrayAccessBlock.java:21)
at WorkflowScript.run(WorkflowScript:3)
at ___cps.transform___(Native Method)