Questions tagged [groovy]

0 votes
2 replies
Groovy Code- Matching a field using regex and generating blank value if not a match
I have a field that was created based on some parsed and reformatted data. If the final result does not match a specific pattern, I want to repla...
asked 4 months ago
0 votes
0 replies
How execute groovy script in release:perform only
I have a maven project where release build is lauched by Jenkins with mvn -B release:prepare release:perform The pom contains a groovy script...
0 votes
1 replies
Jenkins: Decrypting all passwords in credentials.xml (via Jenkins execution console)
How to decrypt all credentials in the Jenkins credentials.xml using the Jenkins console, in bulk? I can do this one secret at a time using this...
asked 4 months ago
0 votes
1 replies
Groovy: Read and then Write to interactive process
I am beginning to think my search skills are lacking. I trying to find any articles on how with Groovy, to open an interactive process, read its...
asked 4 months ago
0 votes
0 replies
How to Implement Active Choice Reactive Reference Parameter in Jenkins (User Input Validation )
I have one s3 bucket which contains three files a.txt b.txt c.txt I want to validate these contents with user input and to show it on API itse...
1 votes
3 replies
Checking if provided String is a valid list of items
I want to validate whether a String provided by the user forms a list of comma-separated items (ints, strings, mixed - doesn't matter) in Groovy....
asked 4 months ago
-1 votes
0 replies
Unreachable code was not flagged by groovy compiler
The break statement after return'1' was not flagged as unreachable by groovy def x = '' switch(x) { case ['Front', 'Steer']: return '1'...
asked 4 months ago
0 votes
0 replies
Is it possible to use return for a string in Groovy?
I am trying to run the code below. However, I use return, it does not work. If I use println, it works. I need to use return because this functi...
asked 4 months ago
0 votes
1 replies
Escaping parameters with white space in the docker .withRun command in Jenkins declarative pipeline
Currently unable to get my head around how to correctly pass my parameters from Jenkins, to the docker .withRun function, in Jenkins Docker Plugi...
asked 4 months ago
0 votes
1 replies
How do I use Micronaut views to send back params and set local storage?
I am trying to use Micronaut Views annotation to send back few params and set local storage then redirect. I used script tag inside autoredirect....
asked 4 months ago
0 votes
0 replies
When to use println in jmeter
I have added JSR223 PreProcessor in jmeter for one request & language selected is groovy (groovy 2.4.15/groovy scripting engine2.0) , so ther...
asked 4 months ago
0 votes
1 replies
How can I get a custom datasource reference in Grails 2.4.X?
I need to query a SQL from a custom lookup datasource in Grails 2.4.5. I cannot use projections because the SQL is too complex. The documentatio...
asked 4 months ago
0 votes
1 replies
Groovy: Returning slash-escaped string causes exception
I have a simple script, which runs and works: println testReturn() String testReturn() { def str = /asdf/ return str } If I change it...
asked 4 months ago
-1 votes
1 replies
Groovy: Convert Json to Text
Would like to convert the below json record into a text using Groovy import groovy.json.* def js = """{ "title": { "titleid": "222",...
asked 4 months ago
0 votes
2 replies
Loop Over Map Variable in Groovy Script
I have a map of data that I have extracted during a Groovy pipeline script. In the next stage of the pipeline I would like to loop through the da...
asked 4 months ago
2 votes
1 replies
GroovyShell and Binding.setVariable() for callable objects
I am experimenting with some dynamic variable creation with GroovyShell and encountered an issue. First, the working code: static def defVar(def...
asked 4 months ago
2 votes
1 replies
Is it possible to compile and test Groovy source files for Java 6 with Gradle 5?
Based on customer requirements I am currently stuck on Java 6 and therefore I am using Gradle 2.14.1 now. In order to be able to upgrade Gradle t...
asked 4 months ago
1 votes
1 replies
Why does this groovy code work differently in jenkins pipeline script
I've got a piece of code that works perfectly in all of the groovy interpreters I know of, including Jenkins scripting console. Yet it has a weir...
asked 4 months ago
1 votes
1 replies
Data Driven Spock test fails with upgrade to groovy 2.5
When the variable in the where clause is named with the same name in the other test but the types are different, the data driven test is trying t...
asked 4 months ago
0 votes
1 replies
Gradle publishing only if it is a release
I have two maven repositories one local and one external. On my local repository, I will publish snapshots and releases. On the external reposit...
asked 4 months ago
-1 votes
3 replies
How to parse a date to get the string in a particular format
I have the date in the format Mon Nov 01 00:00:00 PDT 2010 I want MM/yyyy format. import java.text.SimpleDateFormat; import java.text.ParseExc...
asked 4 months ago
-1 votes
0 replies
How can i generate XML file in SOAP UI from an excel of multiple rows using groovy script?
Please Let me know how to configure scriptom with Groovy in Soap UI. And How can I Generate XML from excel file? -1 Hi welcome to Stackove...
asked 4 months ago
2 votes
1 replies
Groovy script for streamsets to parse string of about 1500 characters
This is for streamsets, I am trying to write groovy script. I have string of length 1500 chars. No delimiter. The pattern is first 4 characters...
asked 4 months ago
0 votes
1 replies
Spock testing - variables getting null value from the new operator
Below is my test code, def 'test write then update with commit after all operations parallely'() { given: def outputPath = "writeThenUpd...
asked 4 months ago
0 votes
1 replies
Groovy Meta Programming: Override Map invokeMethod
I have a java Map<String,Object> that i'm accessing using groovy's magical myMap.property1.nestedProperty1.nestedNestedProperty This is...
asked 4 months ago