docs / guides/create-projectspringboot-cli

Create a project ​

The create command downloads a Maven starter from Spring Initializr, then adds springboot-cli configuration and its package-by-layer project files.

Use interactive prompts ​

bash
springboot-cli create catalog

In an interactive terminal, springboot-cli asks for missing coordinates and can show selectors for available Java, Spring Boot, and Initializr dependency versions. The default project coordinates are com.example for the group ID and catalog for the artifact ID.

Pass options explicitly ​

bash
springboot-cli create catalog \
  --groupId com.acme \
  --artifactId catalog \
  --java-version 21 \
  --spring-boot-version 4.1.1 \
  --dependencies web,data-jpa,lombok
OptionDescriptionDefault
-g, --groupId <groupId>Maven group ID.com.example
-a, --artifactId <artifactId>Maven artifact ID and application name.Project name
-j, --java-version <version>Java version. Supported values are 21, 25, and 26.21
-b, --spring-boot-version <version>Spring Boot version offered by Spring Initializr.4.1.1
-d, --dependencies <deps>Comma-separated Spring Initializr dependency IDs.web,data-jpa,lombok
-f, --forceReplace an existing non-empty project directory.Off

When --dependencies is omitted in an interactive terminal, the dependency selector starts with the default dependencies selected. In a non-interactive session the defaults are used. If Initializr metadata is unavailable during interactive version or dependency selection, the CLI falls back to its defaults; failure to download the project archive still stops project creation.

Generated project ​

For the example above, the project contains the Initializr application and Maven files, springboot-cli configuration, and extra files for the monolith architecture:

text
catalog/
├── pom.xml
├── mvnw
├── springboot-cli.json
└── src/
    ├── main/java/com/acme/catalog/
    │   ├── exception/GlobalExceptionHandler.java
    │   └── exception/ResourceNotFoundException.java
    └── test/java/com/acme/catalog/architecture/
        └── LayeredArchitectureTest.java

The package name is derived from the group ID and a Java-safe form of the artifact ID. For example, catalog becomes com.acme.catalog; punctuation in an artifact ID such as my-app is converted to an underscore in the package segment.

The CLI writes a springboot-cli.json file with project metadata and a link to the editor schema. The configured domain entity schema defaults to schema.json, but that file is not created by create; add it when you are ready to use schema apply.

Run the new project ​

bash
cd catalog
springboot-cli run

See Generated project structure for the package layout and starter files.

--force removes the destination

If the target directory already contains files, --force recursively deletes that directory before downloading the new project. Back up anything you want to keep.