CLI commands
Run spring-cli --help for the installed CLI's help, or spring-cli <command> --help for command-specific help. Running spring-cli without arguments also prints the top-level help.
Create a project
spring-cli create <project-name> [options]Creates a Maven Spring Boot project from Spring Initializr and adds the spring-cli configuration and package-by-layer starter files.
| Option | Description | Default |
|---|---|---|
-g, --groupId <groupId> | Maven group ID. | com.example |
-a, --artifactId <artifactId> | Maven artifact ID and application name. | <project-name> |
-d, --dependencies <deps> | Comma-separated Spring Initializr dependency IDs. | web,data-jpa,lombok |
-j, --java-version <version> | Java version: 21, 25, or 26. | 21 |
-b, --spring-boot-version <version> | Spring Boot version. | 4.1.1 |
-f, --force | Delete and replace an existing non-empty project directory. | Off |
In an interactive terminal, omitted values can be prompted or selected from Spring Initializr metadata. In a non-interactive session the default versions and dependencies are used. --force recursively deletes a non-empty target directory before creating the new project.
See Create a project.
Run an application
spring-cli runRuns Maven's spring-boot:run goal. The project Maven Wrapper is preferred; system Maven is used when no wrapper is present. An optional project-root .env file is passed to the Maven process.
Run tests
spring-cli test [pattern] [--fails-only]Runs Maven's test goal. pattern is passed to Surefire as -Dtest=<pattern> and may be a test class or a comma-separated list of test classes.
spring-cli test ProductServiceTest
spring-cli test ProductServiceTest,OrderServiceTest
spring-cli test --fails-only--fails-only reruns classes with failures or errors found in target/surefire-reports/TEST-*.xml. If no reports contain failed tests, nothing is run. This option takes precedence over pattern.
Add a component
spring-cli add <component> [options]Supported components are controller, service, repository, entity, dto, config, listener, and exception.
| Option | Description |
|---|---|
-n, --name <name> | Logical component name. If omitted, the CLI prompts for one. |
-f, --force | Overwrite the target component file if it exists. |
Generated classes are starter skeletons. add entity creates a plain class; use schema apply for JPA mappings from an entity schema.
Scaffold a CRUD set
spring-cli scaffold <resource> [options]Generates an entity, DTO, repository, service, and controller for the resource.
| Option | Description |
|---|---|
-n, --name <name> | Use this logical name instead of <resource>. |
-f, --force | Overwrite generated files that already exist. |
Apply an entity schema
spring-cli schema apply [--force]Generates JPA entity classes using the project entity schema file, which defaults to schema.json in the project root. -f, --force overwrites existing entity files. See the entity schema reference.
Generate Docker files
spring-cli dockerize [--force]Generates Dockerfile, docker-compose.yml, and .dockerignore. -f, --force overwrites existing files. The command creates configuration; it does not build or run the image.
Inspect and upgrade dependencies
spring-cli deps list
spring-cli deps upgradelist shows Maven dependencies and checks Maven Central for newer stable versions. upgrade updates eligible explicit dependency versions and a declared Spring Boot parent version. BOM-managed dependencies are not changed.
Check environment keys
spring-cli env syncCompares the keys in project-root .env.example with .env and reports missing keys. It does not create or edit the files.
Print shell completions
spring-cli completion <shell>Prints a completion script to standard output for bash, zsh, or fish. Redirect the output to the shell's completion directory. See Shell completions.
Global options
| Option | Description |
|---|---|
-h, --help | Show help for the CLI or a command. |
-v, --version | Show the installed spring-cli version. |
Project commands validate spring-cli.json when loading the project. The current config supports Maven monolith projects; see the configuration reference.