Which maven dependency to include for evaluating groovy scripts in java application
Asked Answered
S

1

6

I've added the ability to parse and evaluate groovy scripts inside my java application using GroovyShell. Which maven artifact is the bare minimum to include in my build?

I know that the groovy-all will definitely contain everything I need, but I'm guessing that there is a smaller package I could use as well?

Scion answered 12/7, 2013 at 13:1 Comment(2)
Not sure, but I think you should just need org.codehaus.groovy:groovy:2.1.6 (which gets you down to 3.3MB from 6.1MB)... I guess it depends what your scripts want to do...Ceto
Seems you're right. I ended up depending on groovy-jsr223 and that seems to work. Half the size as you say...Scion
D
5

groovy-jsr223 is the JSR-223 Engine implementation, and it support evaluation of groovy scripts via JSR-223 standard interface.

ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("groovy");

<dependency>
   <groupId>org.codehaus.groovy</groupId>
   <artifactId>groovy-jsr223</artifactId>
   <version>2.4.6</version>
</dependency>
Diaphaneity answered 27/2, 2016 at 2:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.