The JBang Gradle plugin allows JBang scripts to be executed during a Gradle build.
The plugin attempts to use an existing JBang installation. If no JBang installation is found, the plugin will install JBang by downloading and caching the latest version binaries (in your local Gradle cache directory) for subsequent runs.
This plugin adds a new task of type dev.jbang.gradle.tasks.JBangTask named jbang that accepts the
following properties
| Property | Type | Option | Default | Required |
|---|---|---|---|---|
script |
String |
jbang-script |
✅ |
|
jbangArgs |
List<String> |
jbang-jbang-args |
[ ] |
❌ |
args |
List<String> |
jbang-args |
[ ] |
❌ |
trusts |
List<String> |
jbang-trusts |
[ ] |
❌ |
version |
String |
jbang-version |
latest |
❌ |
installDir |
Directory |
$gradleUserHomeDir/caches/jbang |
❌ |
| script |
The script to be executed by JBang. |
| args |
The arguments to be used in the JBang script (if any) |
| trusts |
If the script resides in a remote location, this parameter specifies what URLs should be trusted. See URLs from Trusted Sources for more information |
| version |
If your environment lacks the JBang binaries in the PATH, you can specify the JBang version to be installed.
The default value is set to |
Example:
$ gradle jbang --jbang-script hello.jsh --jbang-args="Hello world"Option #1
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'dev.jbang:jbang-gradle-plugin:0.4.0'
}
}
apply plugin: 'dev.jbang'Option #2
plugins {
id 'dev.jbang' version '0.4.0'
}