I've "deployed" some scripts to other users in my organization where Java but not Groovy is installed through the GroovyWrapper script. I got it from Codehaus and I can't find the original copy anywhere but I found a fork of it at https://github.com/sdanzan/groovy-wrapper that appears to have more features than the original. The original I have basically just uses the Ant inside of the Groovy distribution to compile a single Groovy file and merge that file, embeddable groovy JAR and some of the Groovy libs into a single jar you can run with java -jar.
Looking at the code it appears the main difference in that updated script is that it supports adding @Grab'd dependencies into the single JAR, presumably to prevent users from having to download them.
From: Jim Northrop [mailto:email@example.com]
Sent: Tuesday, March 08, 2016 8:19 AM
Subject: Re: building a jar from groovy script with gradle
Out of interest, what is the typical deployment strategy for a runnable Groovy class w/main method? I have been trying to make a user executable jar but as 2 diff.jars. One jar is only my code, no support jars and 2nd is mystuff-all-v1.0.jar as a bundle w/all dependency jars included hence runnable. End user can choose jar.
Are there other strategies to package code 4 deployment?
Sent from my iPad
> On 8 Mar 2016, at 11:45, Schalk Cronjé <firstname.lastname@example.org> wrote:
> I can spot a number of issues in your Gradle script, howver I need to understand context.
>  Are you trying to put a single Groovy script + required Groovy JARs into a JAR?
>  Are you trying to build a proper Groovy application consisting of a coouple of class files en dependent JARs?
>> On 08/03/2016 10:33, Raphael Bauduin wrote:
>> I'm trying to package a groovy script as a jar with the help of
>> gradle, I use this gradle config: http://pastebin.com/RFEhzMCp
>> it builds fine, but when I try to run it with java -jar path_to.jar I
>> get this error:
>> Error: A JNI error has occurred, please check your installation and
>> try again Exception in thread "main" java.lang.SecurityException:
>> Invalid signature file digest for Manifest main attributes
>> The only suggestions I found online applied when people repackaged jars, which is not my case.
>> Any suggestion?
> Schalk W. Cronjé
> Twitter / Ello / Toeter : @ysb33r
This email message and any attachments are for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message and any attachments.