How to print each element of Multi-line String Parameter?
The code works fine when disabling a Use Groovy Sandbox option and adding @NonCPS
helper method. Alternatively, as suggested by @agg3l, proceed to Jenkins management to permit this method access.
So the working code is (same as the 2nd example):
@NonCPS
def printParams() {
Params.split("\\r?\\n").each { param ->
println "Param: ${param}"
}
}
printParams()