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

Jenkins Groovy: How do we add 'Execute a Windows batch command' in groovy?

I see that there is a 'shell()' equivalent in groovy script for 'Execute shell command' option in Job UI. What is the equivalent for 'Execute a Windows Batch command'? P.S. Not looking for : def process='xxxx'.execute()as it does not work on the…
Ronak Agrawal
  • 1,006
  • 1
  • 19
  • 48
1
vote
1 answer

How to know that Groovy console window has been closed

I am launching groovy console window in run time through below code. Suppose user has closed the groovy console window. I want to detect closing of window in my program. import groovy.ui.Console public class TestGroovyConsole{ public static void…
virendra chaudhary
  • 179
  • 1
  • 2
  • 18
1
vote
1 answer

Why does DriverManager.getConnection() lookup fail in GroovyConsole?

The following Groovy script works correctly from the command line. (I successfully get a Connection.) // ---- jdbc_test.groovy import java.sql.* Class.forName("com.mysql.jdbc.Driver") def con = DriverManager.getConnection( …
Paul
  • 3,009
  • 16
  • 33
1
vote
1 answer

groovy script Error

I am newbie to groovy. In command prompt (I am not using any IDE), I typed following : (No Problem with environment variables settings please) groovy -n -e "println line.toLong()" data.txt Error : Caught: java.io.IOException: Invalid…
Prashant2329
  • 327
  • 3
  • 7
  • 21
1
vote
1 answer

Groovy Grape configuration on intellij idea 13.1

I have recently migrated to IntelliJ IDEA 13.1 and I'm using it with groovy 2.3. I have used the IDE's support for grab annotations in groovy scripts where with just the key stroke of alt+return the IDE smartly downloads grab dependencies and adds…
Amit
  • 435
  • 3
  • 13
1
vote
2 answers

Jenkins Job Views with different Job names

I have a requirement in Jenkins wherein, We have, for example, 10 jobs in view ABC with specific configuration. Now, I need to create a new view in Jenkins XYZ and clone all the jobs in ABC with different name and change the configuration, for…
Jninja
  • 149
  • 1
  • 3
  • 13
1
vote
1 answer

Creating one-to-many & many-to-many for same domain class in grails

I want to create a domain class as like , One user can post many orders [Bidirectional] and one order can be liked by many users [unidirectional]. I have written a domain class as shown below , Class User { String userName; List orders …
vicky
  • 2,119
  • 4
  • 18
  • 32
1
vote
2 answers

Cron-like application of groovy script with console plugin environment?

We have an application that we would like to run a script on just like we do in the console window with access to the applications libraries and context, but we need to run it periodically like a cron job. While the permanent answer is obviously a…
Jim Gough
  • 148
  • 3
  • 12
1
vote
1 answer

Syntax error in removing bad character in groovy

Hello I have a string like a= " $ 2 187.00" . I tried removing all the white spaces and the bad characters like a.replaceAll("\\s","").replace("$","") . but i am getting error Impossible to parse JSON response: SyntaxError: JSON.parse: bad escaped…
shashank
  • 379
  • 5
  • 6
  • 15
1
vote
1 answer

Embedded Groovy Console--How do I share entire state

I'd like to embed a GroovyConsole into an existing java app for design prototyping and debugging purposes. I'd really like this console to have access to my entire program--mostly this means that any singletons or factories should return the actual…
Bill K
  • 62,186
  • 18
  • 105
  • 157
1
vote
4 answers

Listing subclasses doesn't work in Ruby script/console?

This works: >> class Foo >> def xyz() >> Foo.subclasses >> end >> end => nil >> class Bar < Foo >> end => nil >> class Quux < Bar >> end => nil >> Foo.new.xyz() => ["Quux", "Bar"] But this doesn't. User is a class in my application. >>…
Kyle Kaitan
  • 1,761
  • 3
  • 19
  • 29
0
votes
2 answers

the iterator is printing till 48 when argument supplied is 1

static void main(args){ System.in.withReader { def input = it.readLine() for(def i = 0; i < input; i++){ println i } } } The source code..simple one I guess but dont know why…
Maverick
  • 2,738
  • 24
  • 91
  • 157
0
votes
1 answer

Ant call to grails fails with "[exec] Application is pre-Grails 0.5, please run: grails upgrade"

I am facing a rather odd problem with our groovy build script. The whole project uses a helper groovy script that calls all other build scripts (maven and ant). One of the ant targets invoked by the groovy script calls, invokes through "exec" grails…
Olimpiu POP
  • 5,001
  • 4
  • 34
  • 49
0
votes
0 answers

IntellJ and WSL2 groovy console freeze

I'm trying to use intellij groovy console to test out some scripts. I have install groovy both on my windows machine and inside of WSL2 with sdk command. I have restarted my machine but everytime I try to run the groovy console. IntelliJ freezes…
McFrank
  • 331
  • 3
  • 11
0
votes
2 answers

How do you read multiple lines using readLine in Groovy through SpringSource Eclipse?

I am trying to read multiple inputs from the console in Groovy 1.7.10 in Spring Source Suite 2.7.1 (multiple in.readLine()), but the console only seems to allow me to input the first entry, puts in a blank for the second entry and moves to let me…
jcb
  • 195
  • 1
  • 4
  • 20