To install the latest version, add the following to the lib/bld/bld-wrapper.properties file:
bld.extension-jbang=com.uwyn.rife2:bld-jbangFor more information, please refer to the extensions documentation.
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.