docs / guides/run-scriptsspringboot-cli

Run scripts ​

springboot-cli run reads the scripts object in springboot-cli.json. Bare run lists the available scripts; a script name executes exactly that command.

json
{
  "scripts": {
    "start": "mvnw spring-boot:run",
    "test": "mvnw test",
    "dev": "mvnw spring-boot:run -Dspring-boot.run.profiles=dev",
    "build": "mvnw clean package"
  }
}

Scripts are shell command strings, similar to package.json scripts. They run from the project root, with the project-root .env values loaded and the project root prepended to PATH.

List scripts ​

bash
springboot-cli run

This prints every configured script in alphabetical order and exits successfully. It never starts a child process, even when a start script exists. With no scripts configured, it prints:

text
No scripts defined in springboot-cli.json. Add a "scripts" object to define one.

Run a script ​

bash
springboot-cli run start
springboot-cli run test
springboot-cli run dev

The named script must exist. Names are matched exactly and case-sensitively. An unknown name fails with an error that lists the available scripts.

Arguments after the script name, including values after --, are ignored; the configured command runs unchanged. To pass different arguments, edit the command in springboot-cli.json.

create writes two default scripts: start (mvnw spring-boot:run) and test (mvnw test). They have no special behavior. You can change their commands or add more scripts at any time.

Environment and PATH ​

Before executing a script, springboot-cli loads the project-root .env file, if present. Values from .env override variables with the same name in the current shell. The parser does not expand references such as ${HOME}. See Environment variables for the supported syntax.

The project root is prepended to PATH, so commands such as mvnw resolve to the project Maven Wrapper. If the wrapper is missing, the script fails with the shell's normal command-not-found or non-zero exit behavior. There is no system-Maven fallback.

Exit codes and output ​

The CLI exits with the script's exit code. A failing script produces an error such as:

text
Script 'start' failed: mvnw spring-boot:run exited with code 1

Script output is streamed through inherited standard input, output, and error in normal mode. With --json or --quiet, child output is suppressed so it cannot corrupt the CLI's own output. Omit --json when you need to see the script's logs.

Security ​

scripts executes arbitrary shell commands with your user permissions, just like package.json scripts. Only run scripts from projects you trust. Bare springboot-cli run is safe for inspection because it only lists commands and never executes them.