bld Command Line Execution Extension
To install the latest version, add the following to the lib/bld/bld-wrapper.properties file:
bld.extension-exec=com.uwyn.rife2:bld-execFor more information, please refer to the extensions documentation.
To execute a command at the command line, add the following to your build file:
@BuildCommand
public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.onWindows("cmd", "/c", "start.bat", "-p", "8080")
.onUnix("./start.sh", "--port", "8080")
.execute();
}Use the failOnExit function to specify whether a command non-zero exit value (status) constitutes a failure.
@BuildCommand
public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.onWindows("cmd", "/c", "stop.bat")
.onUnix("./stop.sh")
.failOneExit(false)
.execute();
}You can also specify the work directory:
@BuildCommand
public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.command("touch", "foo.txt")
.workDir(System.getProperty("java.io.tmpdir"))
.execute();
}Please check the ExecOperation documentation for all available configuration options.
The build file of the GraalVM Native Executable Example project uses the extension extensively.