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

StackOverflow https://stackoverflow.com/questions/17615530

  •  02-06-2022
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top