Giter Site home page Giter Site logo

jbang-gradle-plugin's Introduction

jbang-gradle-plugin

Build Status MIT Licensed Gradle Plugin Portal, link= donations Patreon orange


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

Property Type Option System Environment Default Required

script

String

jbang-script

jbang.script

JBANG_SCRIPT

args

List<String>

jbang-args

jbang.args

JBANG_ARGS

[ ]

trusts

List<String>

jbang-trusts

jbang.trusts

JBANG_TRUSTS

[ ]

version

String

jbang-version

jbang.version

JBANG_VERSION

latest

installDir

Directory

jbang.install.dir

JBANG_INSTALL_DIR

$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 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.

Task property values may be specified directly or using their respective environment variable, System property, project property, or task option respectively, for example the following invocations are equivalent

$ gradle jbang --jbang-script hello.jsh --jbang-args="Hello world"

// system properties
$ gradle jbang -Djbang.script=hello.jsh -Djbang.args="Hello world"

// project properties
$ gradle jbang -Pjbang.script=hello.jsh -Pjbang.args="Hello world"

// environment variables
$ export JBANG_SCRIPT="hello.jsh"
$ export JBANG_ARGS="Hello world"
$ gradle jbang

If the org.kordamp.gradle.inline plugin were to be applied to your build (via settings.gradle) then you may invoke this plugin without modifying your build file

$ gradle dev.jbang:jbang-gradle-plugin:0.2.0:jbang -Pjbang.script=hello.java

Installation

Option #1

buildscript {
    repositories {
        gradlePluginPortal()
    }
    dependencies {
        classpath 'dev.jbang:jbang-gradle-plugin:0.2.0'
    }
}
apply plugin: 'dev.jbang.jbang'

Option #2

plugins {
    id 'dev.jbang' version '0.2.0'
}

Building

If you want to build your own release then execute the following

$ ./gradlew -Prelease=true publishToMavenLocal

This will push all artifacts to your local Maven repository from which you may consume them.

jbang-gradle-plugin's People

Contributors

aalmiray avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

jbang-gradle-plugin's Issues

Export JBang script from Gradle Application project..?

You can add the "application" plugin to Gradle script to execute your application using 'gradle run'.

All the prerequisites to write out a JBang script from that Gradle script is there. A Main-Class to execute. All the dependencies (Maven) to formulate the classpath to launch the Main-Class.

Adding this functionality to the jbang-gradle-plugin would allow one just to maintain a Gradle-script and write out its JBang counterpart easily.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.