How to print a Groovy variable in Jenkins?

Solution 1:

The following code worked for me:

echo userInput

Solution 2:

You shouldn't use ${varName} when you're outside of strings, you should just use varName. Inside strings you use it like this; echo "this is a string ${someVariable}";. Infact you can place an general java expression inside of ${...}; echo "this is a string ${func(arg1, arg2)}.