I'm trying to deploy and execute a very simple workflow that runs a groovy script. I implemented the code in Eclipse and I can successfully execute it, but when I try to export it to a .jar file, using Maven, I'm getting an exception saying: Can't find scripting engine for 'groovy'.
I've seen a couple of old topics related to this exception here in the forum, and the solution was to add groovy-all as a dependency (instead of groovy). But I'm already doing it… and still the same problem.
Here is a snapshot of my pom.xml file. Does anybody know what I'm doing wrong here?
Yes, it is in the classpath and when I run the application from the eclipse everything is fine. The problem is when I run the application from the console, using the .jar file generated with Maven.
The pom is presented below. I'm compiling the code with the following command: mvn clean compile assembly:single package And then running the jar by just doing java -jar NAME_OF_THE_JAR. Am I missing something? Do I need to define any environment variable before running the jar? Thanks!
Yes you are: if you run java -jar NAME_OF_JAR, groovy_all will not be on the classpath. You need to run with java -cp path/to/your/libs -jar yourjar.jar (or create a fat jar that includes it)