Sign inSign up

devatherock/scriptjar

By devatherock

•Updated over 2 years ago

CI plugin to convert Groovy scripts to executable jars

Image
0

4.2K

devatherock/scriptjar repository overview

CircleCI Version Codacy Badge Docker Pulls Docker Image Size License: MIT

⁠scriptjar

CI plugin to convert Groovy scripts to JVM executable JAR. It packages all @Grab dependencies and Groovy libraries, so it can be run without Groovy on target machine. Main class name is the same as original script name.

⁠Usage

⁠Docker
docker run --rm \
  -v /path/to/target-repo:/work \
  -w=/work \
  -e PARAMETER_SCRIPT_PATH=/work/TargetRepoScript.groovy \
  -e PARAMETER_OUTPUT_FILE=/work/docker/TargetRepoScript.jar \
  -e PARAMETER_STATIC_COMPILE=false \
  devatherock/scriptjar:1.0.0
⁠vela
⁠Config

The following parameters can be set to configure the plugin.

  • script_path - Relative path to the groovy script file
  • output_file - Relative path to the output file. Optional, defaults to <script-name>.jar
  • static_compile - Indicates whether to compile the script statically. Defaults to false
⁠Examples

Sample vela config:

steps:
  - name: groovy_script_to_jar
    ruleset:
      branch: master
      event: push
    image: devatherock/scriptjar:1.0.0
    parameters:
      script_path: groovy/MyScript.groovy
      output_file: build/libs/my-script.jar
⁠CircleCI
version: 2.1
jobs:
  groovy_script_to_jar:
    docker:
      - image: devatherock/scriptjar:1.0.0
    working_directory: ~/my-repo
    environment:
      PARAMETER_SCRIPT_PATH: groovy/MyScript.groovy                  # Relative path to the groovy script file
      PARAMETER_OUTPUT_FILE: build/libs/my-script.jar                # Relative path to the output file. Optional, defaults to	<script-name>.jar
      PARAMETER_STATIC_COMPILE: false                                # Indicates whether to compile the script statically. Defaults to `false`
    steps:
      - checkout
      - run: sh /scripts/entry-point.sh

⁠Tests

To test the latest plugin images, run the below command

make test

Tag summary

Content type

Image

Digest

sha256:1efac47d4…

Size

129.7 MB

Last updated

over 2 years ago

docker pull devatherock/scriptjar