Creating an executable jar with groovy script

I have a groovy script Automate.groovy. The script does not have a class definition or a main method. I am looking for the simplest way to create a jar containing the script. I tried compiling the groovy script using the following command:

groovyc Automate.groovy

I also have a Manifest file manifest-addition.txt that specifies the main class

Main-Class: Automate

And I created the jar using the command:

jar cvfm Automate.jar mainfest-addition.txt *.class

This gave me a jar with Automate.class and Automate$1.class and a Manifest file with the Main class. But when I tried to run the jar using java -jar Automate.jar I always get the error

cannot find or load main class Automate.

What am I doing wrong here?

There should be a simple way like this to create the 

 

 

 

 

My CC Pay

0
2 comments

Groovy scripts are nice - they allow to use dependencies and write logic in small single file, but Groovy is mostly available on developers machine, but not on servers, so deploying them is a little more tricky. You can package them in uberjar with Gradle, but it requires additional build file and compatible structure, so it is more like project than script already.

 

MyAARPMedicare

0

You should go for alternative way to make the groovy script functional. You could also find some information from the online platform regarding your issues. NSFW tiktok

0

Please sign in to leave a comment.