https://github.com/jbangdev/jbang-gradle-plugin
https://github.com/jbangdev/jbang-gradle-plugin
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jbangdev/jbang-gradle-plugin
- Owner: jbangdev
- License: mit
- Created: 2020-10-01T19:33:29.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-07-07T21:06:05.000Z (9 months ago)
- Last Synced: 2025-08-08T01:32:37.174Z (8 months ago)
- Language: Groovy
- Size: 137 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.adoc
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
= JBang Gradle Plugin
:linkattrs:
:project-owner: jbangdev
:project-name: jbang-gradle-plugin
:project-group: dev.jbang
:project-version: 0.4.0
:plugin-id: {project-group}
ifndef::env-github[]
endif::[]
:icons: font
:required-icon: icon:check[role="green"]
:optional-icon: icon:times[role="red"]
ifdef::env-github[]
:required-icon: :white_check_mark:
:optional-icon: :x:
endif::[]
image:https://github.com/{project-owner}/{project-name}/workflows/Build/badge.svg["Build Status", link="https://github.com/{project-owner}/{project-name}/actions"]
image:http://img.shields.io/badge/license-MIT-blue.svg["MIT Licensed", link="http://opensource.org/licenses/MIT"]
image:https://img.shields.io/maven-metadata/v?label=Plugin%20Portal&metadataUrl=https://plugins.gradle.org/m2/dev/jbang/{plugin-id}.gradle.plugin/maven-metadata.xml["Gradle Plugin Portal, link="https://plugins.gradle.org/plugin/{plugin-id}"]
image:https://img.shields.io/badge/donations-Patreon-orange.svg[link="https://www.patreon.com/user?u=6609318"]
---
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.
== Usage
This plugin adds a new task of type `dev.jbang.gradle.tasks.JBangTask` named `jbang` that accepts the
following properties
[options="header", cols="4*<,^"]
|===
| Property | Type | Option | Default | Required
| script | String | jbang-script | | {required-icon}
| jbangArgs | List | jbang-jbang-args | [ ] | {optional-icon}
| args | List | jbang-args | [ ] | {optional-icon}
| trusts | List | jbang-trusts | [ ] | {optional-icon}
| version | String | jbang-version | latest | {optional-icon}
| installDir | Directory | | $gradleUserHomeDir/caches/jbang | {optional-icon}
|===
[horizontal]
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
link:https://github.com/jbangdev/jbang#urls-from-trusted-sources[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 `latest`, in which case the plugin will always check if the latest jbang release is installed
and proceed to download it if that's not the case.
Example:
[source]
----
$ gradle jbang --jbang-script hello.jsh --jbang-args="Hello world"
----
== Installation
Option #1
[source,groovy]
[subs="attributes"]
----
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath '{project-group}:{project-name}:{project-version}'
}
}
apply plugin: '{project-group}'
----
Option #2
[source,groovy]
[subs="attributes"]
----
plugins {
id '{project-group}' version '{project-version}'
}
----
== Building
If you want to build your own release then execute the following
[source]
----
$ ./gradlew -Prelease=true publishToMavenLocal
----
This will push all artifacts to your local Maven repository from which you may consume them.