Command Line Execution Extension for bld https://github.com/rife2/bld-exec
Find a file
2024-10-27 17:06:00 -07:00
.github/workflows Bumped bld to version 2.0.0-SNAPSHOT 2024-07-22 17:01:34 -07:00
.idea Bumped bld to version 2.1.0 2024-08-29 22:04:30 -07:00
.vscode Bumped bld to version 2.1.0 2024-08-29 22:04:30 -07:00
config Bumped PMD extension to version 0.9.8 2024-04-04 09:44:36 -07:00
lib/bld Bumped PMD extension to version 1.1.5 2024-08-30 11:57:50 -07:00
src Added GitHub repository 2024-10-27 17:06:00 -07:00
.gitignore Added opton to add a List via the command method 2023-08-27 16:46:47 -07:00
bld Initial commit 2023-08-27 09:37:13 -07:00
bld.bat Initial commit 2023-08-27 09:37:13 -07:00
LICENSE.txt Initial commit 2023-08-27 09:37:13 -07:00
README.md Bumped bld to version 2.1.0 2024-08-29 22:04:30 -07:00

bld Command Line Execution Extension

License Java bld Release Snapshot GitHub CI

To install, 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)
            .command("./start.sh", "--port", "8080")
            .execute();
}

Exit Value

Use the failOnExit function to specify whether a command non-zero exit value (status) constitutes a failure.

@BuildCommand
public void startServer() throws Exception {
    final List<String> cmds;
    if (System.getProperty("os.name").toLowerCase().contains("windows")) {
        cmds = List.of("cmd", "/c", "stop.bat");
    } else {
        cmds = List.of("./stop.sh");
    }
    new ExecOperation()
            .fromProject(this)
            .command(cmds)
            .failOneExit(false)
            .execute();
}

Work Directory

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.