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

Running Groovysh in Grails Application does not accept input

I'm trying to find a Pry Deubgger equivalent on Groovy. I found a good enough project named groovy-debugger and updated it's dependencies to run against groovy 2.3.1 which comes with Grails 2.4.0. If I open a groovysh just a blinking cursor will be…
Jahan Zinedine
  • 14,616
  • 5
  • 46
  • 70
0
votes
1 answer

Parsing classes with GroovyShell

I have a groovy script that need to run a method inside a class inside an external groovy script. I know how to run a method within an external groovy script: new GroovyShell().parse( new File( 'foo.groovy' ) ).with { method() } But what if…
user2475310
  • 733
  • 4
  • 13
  • 19
0
votes
1 answer

Adding a method from an external groovy script with GroovyShell()

I have a groovy script (source.groovy) that needs to call a method from another groovy script (external.groovy). The problem is external.groovy imports a library that does not exists so I get an error. Here is an example: Source.groovy: new…
user2475310
  • 733
  • 4
  • 13
  • 19
0
votes
2 answers

Injecting spring service in external groovy class created at runtime

I have an Spring-powered app and want to integrate groovy. Specifically, I have one abstract java class with a set of abstract method definitions and one repository inyected with autowired. This class must be implemented by several final groovy…
Antonio Acevedo
  • 1,480
  • 3
  • 21
  • 39
0
votes
1 answer

Why does nothing happen when I make a new Class in this GroovyShell?

Why does nothing happen when I make a new Class in this GroovyShell? GroovyShell shell = new GroovyShell(); String a = "class ReportFrame$id{}; new ReportFrame$id();"; shell.evaluate(a);
edJona-
  • 23
  • 4
0
votes
1 answer

Syntax error on my Groovy script?

I am using GroovyShell (2.1.7) to dynamically evaluate some Groovy code that I have stored off as a string. GroovyShell shell = magicallyInstantiateAndBindGroovyShell(); The above method takes care of instantiating the shell, and binding all the…
user1768830
0
votes
1 answer

Evaluate large Groovy script in in GroovyShell

I'm using GroovyConsole to evaluate scripts I get from external sources. So the code to evaluate is dynamic and I don't have control over it. Actually is written into a database and I have to read it as a String. Not perfect, but that's how it…
moeTi
  • 3,884
  • 24
  • 37
0
votes
1 answer

How to connect to sharepoint 2010 cloud and read a list using groovy

I am not finding a way regarding how to connect to sharepoint 2010 cloud and read a list using groovy scrip .I googled a lot but did not find any clue.Kindly suggest me an idea or any resource how to do that? Thanks in advance.
gshashank
  • 23
  • 1
  • 1
  • 6
0
votes
1 answer

Error on SimpleTemplateEngine embedded in Java: Could not instantiate custom Metaclass for class: java.util.ArrayList

I have a app where my users input a HTML template with SimpleTemplateEngine notation, and execute this template with code above, in a Java Class: new SimpleTemplateEngine().createTemplate(templateStr).make(map).toString() and I obtain this…
Igor
  • 1
  • 2
0
votes
1 answer

GroovyShell debug script from classpath

this did help me quite alot for debugging Groovy scripts when invoked via GroovyShell. However, this still only works, when the script is loaded via fully qualified file name (e.g. file:///home/user/x/src/main/groovy/package/File.groovy). When I…
Timo Böwing
  • 313
  • 1
  • 2
  • 8
0
votes
1 answer

How to make Groovy Shell read # symbol

I am having trouble getting the following code to compile in groovy. String execute(Document doc){ CompilerConfiguration configuration = new CompilerConfiguration() configuration.setSourceEncoding("UTF-8") binding = new Binding(); …
evermean
  • 1,255
  • 21
  • 49
0
votes
1 answer

groovysh and groovy classes visibility and annotation parsing

I started using groovy intensely to prototype everything. This is amazing. But I faced the problem with groovy shell. Next code I run with groovy filename.groovy and everything works as expected. But within groovysh command load…
Mykola Golubyev
  • 57,943
  • 15
  • 89
  • 102
0
votes
2 answers

Overriding libraries shipped with groovy in groovsh?

Groovy ships various third party libraries. The servlet-api (v2.4) is an example for groovy (v 2.0.1): groovy:000> javax.servlet.http.HttpServlet.protectionDomain.codeSource ===> (file:/usr/lib/groovy/2.0.1/lib/servlet-api-2.4.jar
Andreas Steffan
  • 6,039
  • 2
  • 23
  • 25
-1
votes
3 answers

Need to convert a string "4AAC6AA8D5827BA" to into this format "4a:ac:6a:a8:d5:82:7b" using groovy

I am trying to convert this string string "4AAC6AA8D5827BA" to into this format "4a:ac:6a:a8:d5:82:7b" using groovy. Could you please asssit
Arulvelu
  • 7
  • 1
  • 7
-1
votes
1 answer

Start of previous year

**DATE FROM:** def format=new java.text.SimpleDateFormat("yyyyMMdd") def cal=Calendar.getInstance() cal.get(Calendar.YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 31); [format.format(cal.getTime())] **DATE TO:** def format=new…
disaster
  • 7
  • 4
1 2 3
16
17