Questions tagged [groovy-console]

The Groovy Console is a Java Swing based graphical user interface that is packaged with the Groovy distribution. It provides a simple but elegant way of executing interactive groovy scripts, with Groovy script entered in the top window, and the output of the script appearing in the lower window.

The Groovy Console is a Java Swing based graphical user interface that is packaged with the Groovy distribution. It provides a simple but elegant way of executing interactive groovy scripts, with Groovy script entered in the top window, and the output of the script appearing in the lower window.

The console is launched with one of a few variations of a command line call to groovyConsole. The variations comprise platform differences and executables that are compiled for some operating systems. It's location is:

<Groovy Home>\bin\groovyConsole[.*]

Variations include:

  • groovyConsole.bat (Windows)
  • groovyConsole.exe (Windows)
  • groovyConsole (Unix/Linux)

Groovy Console Snapshot

enter image description here

GroovyConsole Functions

Some of the useful functions provided in the UI are:

  • File Open / File Save / File New
  • New Window (multiple open windows supported)
  • Standard Edit Menu Functions (Copy/Paste/Undo/Redo/Search/Replace)
  • Various UI Property Toggles and Controls
  • Groovy AST Viewer
  • Groovy Variables Viewer
  • Compile Scripts
  • Run Scripts
  • Interrupt Running Script
  • Add JAR to Classpath
  • Add Directory to Classpath
162 questions
0
votes
2 answers

Filtering/Selecting array values from index in Json in groovy

Trying to filter selective index. Fieldid values changes with every build, What do not change is fieldName": "TX.Sessionval.cost". Need to filter out the whole stringval and save into variable fieldName": "TX.Sessionval.cost" [ { "Fieldid":…
GPs
  • 67
  • 1
  • 10
0
votes
3 answers

Create a Map with Lists looping XML

I have a requirement which i am not able to solve. My XML looks like the…
Sam
  • 13
  • 4
0
votes
1 answer

groovy convert from csv to json

How can I convert a CSV into JSON and access the objects individually for creating a custom string? In the following code why I cannot view the output of log.info(rows.Id[0]) ?????? When i print it shows me null in console. data.csv has two columns…
bbb
  • 149
  • 2
  • 18
0
votes
1 answer

Find a String version of a GroovyConsole Script in a Heap Dump

I've accidentally ran a script with an infinite loop in GroovyConsole. :-\ For the sake of Murphy's Law, I haven't save my work during 3 or 4 hours. So, before killing the GroovyConsole Process, I've dumped the heap, with the hope to find a String…
Grooveek
  • 10,046
  • 1
  • 27
  • 37
0
votes
0 answers

Groovy Script implementation and filtering the result

I have this groovy script : def response = ["curl", "-X", "GET", "-H", "X-Auth-Key: key", "-H", "X-Auth-Email: mail", "https://api.cloudflare.com/client/v4/zones?page=1&per_page=1000"].execute().text println $(response) This script is working for…
0
votes
1 answer

Groovy: Could not find matching constructor

Can anyone help me resolve why I am getting this run time error(cannot find the matching constructor) for the following class (JobStage). I tried to create an instance of the following class but it results in the following run time error. class…
0
votes
1 answer

unexpected token in soapUI Groovy Script

import com.eviware.sopeui.support.XmlHolder def addreq=testRunner.testCase.testSuite.testCases["addEmployee"].testSteps["add"].getPropertyValue("Request") def name=testRunner.testCase.testSuite.testCases["addEmployee"].getPropertyValue("name") def…
Ram Mali
  • 27
  • 1
  • 1
0
votes
1 answer

How to redirect "println" commands output to a file in Groovy

I would like to redirect out of println command which is details of job like Build name, status, time etc to another file. Below is snippet of my code who's output i want to redirect to a file. def lastBuildEnvVars = lastbuild.getEnvVars() println…
NoobCoder
  • 3
  • 1
  • 3
0
votes
0 answers

error seeing when parsing the json response using groovy

import groovy.json.JsonSlurper def testStepName = 'Adding_Users' def jsonSlurper = new JsonSlurper() def response = context.expand('$(testStepName#Response)') def usersInfomration = jsonSlurper.parseText(response) String userName =…
0
votes
2 answers

How to remove comma from string 1,398.90 using groovy

I am not able to remove comma from string 1,398.90 using groovy def liveprice = '1,398.90'; def liveprice2 = liveprice.replaceAll(',', '')
Guru
  • 11
  • 2
0
votes
0 answers

Groovy Console with Java 9 throws JAXBException

Windows 10 OS, Java 9, Groovy 2.5.7 (newly upgraded) I launch the Groovy Console, and run this println "hello" I get this exception Exception thrown java.lang.NoClassDefFoundError: Unable to load class…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
0
votes
1 answer

groovysh is giving invocation target exception

I recently installed groovy. C:\Users\Shivendra Gupta>groovy -v WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass…
AConsumer
  • 2,461
  • 2
  • 25
  • 33
0
votes
1 answer

Fetch value from json array key starts with @

I am trying to access the value of @angular/core from json file looks like bellow "dependencies": { "@angular/animations": "^6.1.0", "@angular/common": "^6.1.0", "@angular/compiler": "^6.1.0", "@angular/core": "^6.1.0", …
Shibon
  • 1,552
  • 2
  • 9
  • 20
0
votes
1 answer

How do you print the response in a Grails / Spock test instead of: org.grails.plugins.testing.GrailsMockHttpServletResponse@62c0fcae

I'm writing Spock tests for my Grails backend. I'm quite new to testing in Grails, and I'm trying to view the response to my mock request. When I write println(response) I see this in the standard output:…
alex glaze
  • 53
  • 10
0
votes
2 answers

Groovy variable double substitution

I would like to perform double substitution. When printing: def y = "\${x}" def x = "world" def z = "Hello ${y}" println z It prints: Hello ${x} When I would like it to print Hello World, I tried performing a double evaluation ${${}},…
GalloCedrone
  • 4,869
  • 3
  • 25
  • 41