Thanks to visit codestin.com
Credit goes to github.com

Skip to content

rife2/bld-jbang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JBang Extension for bld

License Java bld Release Snapshot GitHub CI

To install the latest version, add the following to the lib/bld/bld-wrapper.properties file:

bld.extension-jbang=com.uwyn.rife2:bld-jbang

For more information, please refer to the extensions documentation.

Execute a JBang command

For example, to execute a JBang script, add the following to your build file:

@BuildCommand(summary = "Runs JBang script")
public void jbang() throws Exception {
    new JBangOperation()
            .fromProject(this)
            .jBangArgs("--quiet")
            .script("path/to/script.java")
            .args("foo", "bar")
            .execute();
}

Then run the following command:

./bld jbang

The script will be executed using the currently installed instance of JBang. To manually specify the location of the JBang home use the one of the jBangHome() methods.

To set trusts before running a script, you could do something like:

@BuildCommand(summary = "Runs JBang script")
public void jbang() throws Exception {
    var trusts = List.of("https://github.com/", "https://jbang.dev/");
    var op = new JBangOperation().fromProject(this);
    op.jBangArgs("trust", "add").jBangArgs(trusts).execute();
    op.reset();
    op.script("https://github.com/jbangdev/jbang-examples/blob/main/examples/helloworld.javall").execute();
}

Please check the documentation for all available configuration options.