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
1 answer

By-step with groovy does not extract values for some node

The problem is described as following: I want to find some interested paths and get corresponding properties of vertices or edges, the groovy I used is as following: g.V().has("p_v_name",…
dulq
  • 245
  • 3
  • 11
0
votes
2 answers

How to call groovy inner class

This is my code, and I try to call the method in the inner class as shown below (the last line, ic = new oc.Inner()). But I get error. I am using groovy console, and according to groovy documentation I expect that the Inner class can be called from…
Ranj
  • 1
  • 1
  • 3
0
votes
1 answer

Regex using mix of decimals and numbers in an array

Struggling to find a way to multiply the numbers in the below array [120.98 7, 151.99 8, 141.39 4, 137.71 7, 121.27 6, 187.29 11] Trying to split them by space using split and multiply them however facing issues, any ideas ? Ask is to multiply the…
Raj
  • 29
  • 1
  • 2
0
votes
1 answer

Importing Spring Framework in groovyConsole throws error

I have a very simple Groovy script: import org.springframework.*; @groovy.transform.ToString() @Controller(name="myHomeController") class HomeController { String home() { } } As I use the @Controller annotation I used the menu option:…
Victor M Perez
  • 2,185
  • 3
  • 19
  • 22
0
votes
3 answers

Why map.collectEntries() not working for this data [[Name:sub, Value:23234]] - Groovy

Why this works: def m = [[1,11], [2,22], [3,33]] println(m.collectEntries()) output: [1:11, 2:22, 3:33] But this doesn't work: def m = [[Name:sub, Value:23234], [Name:zoneinfo,…
Hexa
  • 87
  • 1
  • 2
  • 5
0
votes
2 answers

Newb to groovyConsole and struggling with importing Grails converters

I'll still just a pup when it comes to using Groovy's and Grails' tools. I want to use groovyConsole to test some ideas. The code I want to try involves using Grails converters, json to be exact. I found a nice post that explains how to do this by…
Rich Sadowsky
  • 966
  • 1
  • 12
  • 22
0
votes
1 answer

groovy: How to remove lines from a file that begin with a non unique string

*** Edited example to show order is not a factor I have a file with the content: ABC-123 BLA bla
ABC-123 lala lala
ABC-234 AAA
ABC-123 CCC
ABC-567 ddd
ABC-234 BBB

I would like to remove the lines that have a…
Ivory Micky
  • 541
  • 1
  • 6
  • 20
0
votes
2 answers

Regex for groovy not working

Please find below my code. I am trying to iterate through files and in a directory and print out all the match to the regex: (&)(.+?\b) however this doesn't seem to work (it returns an empty string). Where did I go wrong? import…
0
votes
1 answer

DateTimeFormatterBuilder parsing days below 31 SMART not STRICT if appendValueReduced is used

Playing in groovyConsole with DateTimeFormatter and DateTimeFormatterBuilder String inputDateString = "31.2.58" // german date format dtfIn = DateTimeFormatter .ofPattern ( "d.M.uu" ) .withResolverStyle ( ResolverStyle.STRICT…
rawi
  • 521
  • 3
  • 13
0
votes
0 answers

Groovy script to establish connection to ActiveMQ

I'm new to groovy. Can anyone help me how to establish a connection to ActiveMQ through a groovy script? That would be really helpful.
Viknesh
  • 71
  • 1
  • 2
  • 6
0
votes
2 answers

Cannot invoke method getLastSuccessfulBuild() on null object

Unable to retrieve Jenkins job last successful job variables or Parameters via Groovy script so that I can pass these to next job as a variable. import jenkins.model.Jenkins def job = Jenkins.instance.getJob("Testing-4") def run =…
asur
  • 1,759
  • 7
  • 38
  • 81
0
votes
1 answer

Groovy regex for any string between two fields

I am using groovy regex: notification.ietf-restconf:notification.my-pma-device-notification:device-notification.device-notification.notification.~/.[A-Za-z]$/.entity-ref* for any string between notification and entity-ref but its not working. What…
0
votes
0 answers

Calling a class's static method in Groovy Console

I have a Groovy class that has no constructor, and contains only static methods. In GroovyConsole, after importing the class and then trying to call a static method of the class, I get a java.lang.NoClassDefFoundError: Could not initialize class…
dmux
  • 442
  • 7
  • 24
0
votes
0 answers

How to use Console.readInteger() in GroovyConsole?

my groovy script code is like this: import console.* def data=Console.readInteger() println "data:${data}" But when I ran it, I got exception: Exception thrown groovy.lang.MissingMethodException: No signature of method: static…
Julian20151006
  • 191
  • 6
  • 12
0
votes
1 answer

Retrieve value in map by key in Groovy

def text= ''' 2016-10-18_20_34-46-_server-21.000.409_client-21.000.407.zip 2016-10-18_21_57-33-_server-21.000.409_client-21.000.407.zip
user1888955
  • 626
  • 1
  • 9
  • 27