Top "Groovy" questions

Groovy is an object-oriented programming language for the Java platform.

Show a Jenkins pipeline stage as failed without failing the whole job

Here's the code I'm playing with node { stage 'build' echo 'build' stage 'tests' echo 'tests' stage 'end-to-end-tests' def e2e = …

jenkins groovy jenkins-workflow jenkins-pipeline
How do you load a groovy file and execute it

I have a jenkinsfile dropped into the root of my project and would like to pull in a groovy file …

jenkins groovy jenkins-pipeline
What's wrong with Groovy multi-line String?

Groovy scripts raises an error: def a = "test" + "test" + "test" Error: No signature of method: java.lang.String.positive() is …

string groovy multiline
How do I make Jenkins 2.0 execute a sh command in the same directory as the checkout?

Here's my Jenkins 2.x pipeline: node ('master'){ stage 'Checkout' checkout scm stage "Build Pex" sh('build.sh') } When I run …

shell jenkins groovy jenkins-pipeline
Groovy: what's the purpose of "def" in "def x = 0"?

In the following piece of code (taken from the Groovy Semantics Manual page), why prefix the assignment with the keyword …

groovy keyword
Does groovy have an easy way to get a filename without the extension?

Say I have something like this: new File("test").eachFile() { file-> println file.getName() } This prints the full filename …

java file-io groovy file-extension
Failing a build in Jenkinsfile

Under certain conditions I want to fail the build. How do I do that? I tried: throw RuntimeException("Build failed …

jenkins groovy jenkins-pipeline
Groovy filter criteria on findAll on a list

I trying to build dynamic filters using findAll on a list. I have a variable that needs to be included …

groovy findall
What are "Groovy" and "Grails" and what kinds of applications are built using them?

Nowadays I hear a lot about "Groovy on Grails" and I want to know more about it: What is Groovy? …

grails groovy
groovy: how to replaceAll ')' with ' '

I tried this: def str1="good stuff 1)" def str2 = str1.replaceAll('\)',' ') but i got the following …

groovy replaceall