CodingSamples
CodingSamples

Reputation: 219

Run groovy uncompiled script with single jar file on java jre

I would like to execute uncompiled groovy scripts with the java jre. I would like to provide just one jar file to do this. I think in older groovy versions this was possible with a groovy-all jar.

e.g. java -cp lib/groovy-all-2.4.6.jar;. groovy.ui.Main myscript.groovy

But this groovy all jar does not exist for new groovy versions. Is there another jar to do that?

Upvotes: 0

Views: 233

Answers (2)

cfrick
cfrick

Reputation: 37033

There are many groovy-$something artifacts (sql, json, ...) and all was just the combined jar with all of them in it in the 2.4 days.

Now the "-all" is only deployed as Bill Of Materials, that itself no longer is/contains a jar, but points to all other groovy-$something artifacts itself as transitive deps.

So using "groovy.jar" and "groovy-(a|b|c).jar" might be a way out for you and this all boils down to one jar, if you don't need anything else but groovy.jar.

Or you could roll your own "all" jar (e.g. build a uber-/fat/shadow-jar in a project with all deps you need (e.g. groovy-all and whatnot).

Upvotes: 1

CodingSamples
CodingSamples

Reputation: 219

I found the gradle-groovy-all project in this thread. This works fine for me. With the newest commit on the master branch the dependency org.apache.ivy is incuded in the built jar.

Upvotes: 1

Related Questions