Questions tagged [groovyscriptengine]

45 questions
3
votes
2 answers

How to load groovy scripts from within the jar file?

I am using groovy to execute a set of groovy scripts, which works fine when the runtime jar is deployed with the webapp and the runtime executes the groovy scripts present under C:\jboss-eap-7.4\bin (java working directory). Due to portability and…
Ricky
  • 314
  • 1
  • 7
  • 22
3
votes
1 answer

Append CompiledScript or add two CompiledScript

Hello I'm using Groovy engine to eval a certain script. The problem is that the execution time is a little bit big, so I want to separate my script into two scripts. The first one is static and can be compiled inside @PostConstruct method and the…
Mehdi Bouzidi
  • 1,937
  • 3
  • 15
  • 31
3
votes
1 answer

Class that implements trait with annotated field loses annotation on trait field if annotation contains closure field

#!/usr/bin/env groovy import java.lang.annotation.Retention import java.lang.annotation.RetentionPolicy @Retention(RetentionPolicy.RUNTIME) @interface AnnotationWithClosure { Class closure() default { true } } trait TraitWithAnnotatedField { …
2
votes
0 answers

How to Store the Compiled Groovy Script in Database and can be fetched when needed?

I have an application which use the same groovy script for multiple times. Everytime, it compiles the same script again and again during runtime. In order to improve the performance, I need to compile the script only once and store the compiled…
2
votes
1 answer

How to mock groovy class that is used in script?

I have some generator classes, that are used in my custom steps in Jenkins Pipeline. I would like to test those steps (which are groovy scripts), together with mocking classes that are used inside. While testing scripts is not a problem, mocking…
kaskader
  • 51
  • 6
2
votes
1 answer

Create instances of java class using Groovy script

I am using Groovy script and Java, I am new to the subject. I am trying to create multiple instances of a java class (A) from groovy script and pass them to list, then pass this list to a new class (B). my B java file is: public class B { public…
Ggdw
  • 2,509
  • 5
  • 24
  • 22
1
vote
2 answers

Groovy access script variable from application

Need to access the variable defined in the groovy script file Before executing the script using GroovyShell However, I am getting error: groovy.lang.MissingPropertyException: No such property: _THREADS for class:…
Hexgear
  • 320
  • 1
  • 3
  • 13
1
vote
1 answer

Groovy: how to override time unit of @TimedInterrupt in an ASTTransformationCustomizer?

I'm using Groovy 4.0.2 as a runtime scripting environment for my application. My goal is to introduce timeout handling into user-provided scripts, but depending on what the script is used for, different timeouts should apply. My compiler…
1
vote
1 answer

extending java.lang.String in groovy script

i've a rather complex problem. I'am currently developing a a little groovy based script language for an ERP System. The functions and syntax of "my" script language are based on the already existing old FO language which is used by the erp…
1
vote
0 answers

IntelliJ IDEA LiveTemplate auto increment between usages

I am trying to make my life easier with Live Templates in intelliJ I need to increment some param by 1 every-time I use the snippet. So I tried to develop some groovyScript, and I am close, but my groovy capabilities keeps me back. the number is not…
Noyloy
  • 134
  • 1
  • 6
1
vote
0 answers

groovy.lang.MIssingPropertyException: No such property: testRunner for class:

I have previously tested this code on its own, once moving it into my class it breaks and gives me the error. groovy.lang.MIssingPropertyException: No such property: testRunner for class: csvConsume class csvConsume { static void main(args) { …
Cylus
  • 11
  • 3
1
vote
1 answer

Groovy script won't run due to NoClassDefFoundError

I wrote a very simple groovy script to test if a cron expression is valid: import hudson.scheduler.CronTabList try { def cron = CronTabList.create("@daily") println("Valid cron!") } catch(Exception e) { println("Invalid cron!") …
George Cimpoies
  • 213
  • 1
  • 3
  • 13
1
vote
1 answer

How to replace tinkerpop imports by janus-graph imports during initialization of gremlin groovy script engine?

I initialize gremlin-script-engine with janus-plugin in this way: GremlinScriptEngineManager engineManager = new DefaultGremlinScriptEngineManager(); engineManager.addPlugin(JanusGraphGremlinPlugin.instance()); engine =…
0
votes
0 answers

How can I format a double in CPI groovyscript?

I have a requirement to convert a salary value: 100000 into 1,000.00. Salary is in double data type. I am using Groovy Script in this project but I have zero knowledge on how to use it. I am not sure on how to use it or to declare it. Can you guys…
0
votes
0 answers

Groovy - How to print all variables in scope of script engine?

I am building workflows using a proprietary engine leveraging Flowable. The engine comes with preloaded beans that can be used from groovy script tasks and I would like to introspect all variables in scope. I used the following…
1
2 3