I’m using the Jenkins pipeline feature to run a declarative pipeline in which I’m trying to define a variable:
pipeline {
   agent none
   stages {
       stage("first") {
           def foo = "foo" 
           sh "echo ${foo}"
       }
   }
}
I get the following error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 5: 
           def foo = "foo"
           ^