Questions tagged [groovyshell]

The term groovyshell refers to both: 1. A command line interactive groovy shell, usually invoked as "groovysh" 2. One of the primary classes (groovy.lang.GroovyShell) in the Groovy language API for dynamically compiling and invoking groovy scripts from their raw source state.

The term groovyshell refers to both:

  1. A command line interactive groovy shell, usually invoked as "groovysh"
  2. One of the primary classes groovy.lang.GroovyShell) in the Groovy language API for dynamically compiling and invoking groovy scripts from their raw source state.

Groovysh

A command line groovy interpreter, well documented in the official documentation.

GroovyShell (the class)

groovy.lang.GroovyShell is one of the core classes of the Groovy runtime. It provides support for interpreting, evaluating and compiling groovy scripts in their raw source state. The base support for source read targets are:

  1. Java Files
  2. Java Input Streams
  3. Java Readers
  4. Java Strings
  5. Groovy GroovyCodeSources (A special source construct that isolates the contained source and generated byte code)
247 questions
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
0
votes
1 answer

Unable to apply Newify on Groovyshell

I want to run some dynamic script with help of Groovyshell. But, i don't want to write new keyword in dynamic script. So, i thought of adding a CompilerConfiguration with Newify keyword. But, things are not working as expected. CompilerConfiguration…
Sanket Bajoria
  • 748
  • 6
  • 18
0
votes
1 answer

Prevent groovysh from stealing focus on macOS

When launching the Groovy REPL, groovysh, it also launches a separate support app that appears in the dock. This app thus steals focus meaning I can't start typing into the groovysh interpreter immediately; I need to click back to the terminal to…
Friedrich 'Fred' Clausen
  • 3,321
  • 8
  • 39
  • 70
0
votes
1 answer

Create "unless" statement as a binding from user defined script

I have a task in which I need to implement a processor for user script where in one part of the script unless appears and it needs to behave as the opposite of if statement. Is there a way to create a binding which is going to behave like that. I am…
hcerim
  • 959
  • 1
  • 11
  • 27
0
votes
3 answers

Groovy: Executing azure CLI Command with JSON - Parsing Issue?

Currently I fail to run an azure CLI command from Groovy because of the JSON Part in the Command. There is an azure command to run custom scripts on a virtual machine. The CommandToExecute on the Machine is passes as JSON. WORKING…
TheShadow
  • 581
  • 4
  • 10
0
votes
1 answer

Groovy invoking unintended "get(String)" method in script's base class

I have a small program that lets its user execute arbitrary Groovy code. I use a base groovy.lang.Script class that provides a number of methods, of which one is named get. All this code is written in Java. Base class: import…
ernest_k
  • 44,416
  • 5
  • 53
  • 99
0
votes
1 answer

MissingPropertyException: No such property: request for class: Script1

How to run a groovy script in java from a servlet? With the below code, I have a MissingPropertyException: No such property: request for class: Script1 This is my script