https://github.com/alipsa/groovyjar
Bash script to run a groovy jar
https://github.com/alipsa/groovyjar
Last synced: 5 months ago
JSON representation
Bash script to run a groovy jar
- Host: GitHub
- URL: https://github.com/alipsa/groovyjar
- Owner: Alipsa
- License: mit
- Created: 2025-02-22T21:03:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-23T11:38:17.000Z (over 1 year ago)
- Last Synced: 2025-06-22T19:52:37.340Z (12 months ago)
- Language: Shell
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Groovyjar
This is a simple bash script that is equivalent to `java -jar` i.e. it provides the ability to "execute" a jar file but with groovy libraries added to the classpath
It takes 1-3 arguments:
1. The first one is the path to the jar file to execute.
2. The second argument is an optional parameter for the main class to execute. If it is not given then the main class to execute it extracted from the META-INF/MANIFEST.MF file in the jar.
3. The third (optional) argument are parameters passed to the main method of the class. These arguments are enclosed in a quote and separated by space.
Examples:
Execute a jar using the Main-Class attribute from the manifest:
`groovyjar build/libs/groovyjar-1.0-SNAPSHOT.jar`
Execute a jar using the Main-Class attribute from the manifest with params:
`groovyjar build/libs/groovyjar-1.0-SNAPSHOT.jar --args="Foo Bar Baz"`
Execute a jar providing the class to run:
`./groovyjar build/libs/groovyjar-1.0-SNAPSHOT.jar se.alipsa.groovy.Greeting`
Execute a jar providing the class to run with params:
`./groovyjar build/libs/groovyjar-1.0-SNAPSHOT.jar se.alipsa.groovy.Greeting --args="Foo Bar Baz"`
### Note
please don't be confused by the src/main stuff. This is just a simple groovy class used for testing the script.
The actual groovyjar script is in the root of this project