tagged [groovy]

Java/Groovy - simple date reformatting

Java/Groovy - simple date reformatting I'm new to Java/Groovy development and I have a simple string that I would like to reformat, however I get an 'Unparseable date' error when I attempt to run the ...

17 Jan at 16:18

Is it possible to Git merge / push using Jenkins pipeline

Is it possible to Git merge / push using Jenkins pipeline I am trying to create a Jenkins workflow using a Jenkinsfile. All I want it to do is monitor the 'develop' branch for changes. When a change o...

4 Aug at 14:18

Including a groovy script in another groovy

Including a groovy script in another groovy I have read [how to simply import a groovy file in another groovy script](https://stackoverflow.com/questions/8738118/how-to-simply-import-a-groovy-file-in-...

23 May at 12:2

Gradle does not find tools.jar

Gradle does not find tools.jar I am using javadoc doclets with gradle, so I need to use the package tools.jar, which is in the lib folder from the jdk (1.6.0_26 in my case). The point is that gradle d...

15 Mar at 06:11

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

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-test...

Dynamically adding elements to ArrayList in Groovy

Dynamically adding elements to ArrayList in Groovy I am new to Groovy and, despite reading many articles and questions about this, I am still not clear of what is going on. From what I understood so f...

12 Jun at 16:14

How can I embed one file into another with Ant?

How can I embed one file into another with Ant? I am developing a small web app project (ColdFusion) and I am trying to keep my project split into multiple files during development, but deploy just on...

6 Oct at 17:25

Groovy type conversion

Groovy type conversion In Groovy you can do surprising type conversions using either the `as` operator or the `asType` method. Examples include I'm surprised that I can convert from an Integer to a Sh...

8 Mar at 17:49

Groovy String to Date

Groovy String to Date I am coding this with Groovy I am currently trying to convert a string that I have to a date without having to do anything too tedious. Output: The above code works just fine, ho...

29 Sep at 00:2

Access to build environment variables from a groovy script in a Jenkins build step (Windows)

Access to build environment variables from a groovy script in a Jenkins build step (Windows) I'm using Scriptler plugin, so I can run a groovy script as a build step. My Jenkins slaves are running on ...

jenkins pipeline: multiline shell commands with pipe

jenkins pipeline: multiline shell commands with pipe I am trying to create a Jenkins pipeline where I need to execute multiple shell commands and use the result of one command in the next command or s...

17 Apr at 13:19

String concatenation with Groovy

String concatenation with Groovy What is the best (idiomatic) way to concatenate Strings in Groovy? Option 1: Option 2: I've founded an interesting point about this topic i

Is there a null-coalescing (Elvis) operator or safe navigation operator in javascript?

Is there a null-coalescing (Elvis) operator or safe navigation operator in javascript? I'll explain by example: Elvis Operator (?: ) > The "Elvis operator" is a shortening of Java's ternary operator....

Gradle: getting the root project directory path when starting with a custom build file

Gradle: getting the root project directory path when starting with a custom build file The structure of my Gradle project is the following: Normally to get the absolute path of the `foo` folder I can ...

13 Jan at 13:13

groovy: safely find a key in a map and return its value

groovy: safely find a key in a map and return its value I want to find a specific key in a given map. If the key is found, I then want to get the value of that key from the map. This is what I managed...

2 Sep at 02:43

Jenkins pipeline if else not working

Jenkins pipeline if else not working I am creating a sample jenkins pipeline, here is the code. ``` pipeline { agent any stages { stage('test') { steps { sh 'echo hello' ...

24 Apr at 12:21

Groovy write to file (newline)

Groovy write to file (newline) I created a small function that simply writes text to a file, but I am having issues making it write each piece of information to a new line. Can someone explain why it ...

24 Nov at 22:58

No signature of method: is applicable for argument types error in Groovy

No signature of method: is applicable for argument types error in Groovy I am quite new to groovy and getting following error when running the below method. I am trying to pass xml file name and Map #...

21 Jul at 00:38

After grails clean I can't run-app

After grails clean I can't run-app I did a `grails clean` and afterwards when I run via `grails run-app` the app never starts and the following is repeatedly displayed (goes on forever, stuck in some ...

28 Dec at 18:51

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script7.groovy: 1: unable to resolve class

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script7.groovy: 1: unable to resolve class I am currently receiving this error when trying to run a soapui file: ``` org...

Groovy Mixins?

Groovy Mixins? I'm trying to mix-in a class in my Groovy/Grails app, and I'm using [the syntax defined in the docs](http://docs.codehaus.org/display/GroovyJSR/Mixins#Mixins-StaticMixing), but I keep g...

8 Jan at 19:50

How to print a Groovy variable in Jenkins?

How to print a Groovy variable in Jenkins? I have the following code within a Jenkins pipeline: ``` stage ('Question') { try { timeout(time: 1, unit: 'MINUTES') { userInput = input message...