For the latest stable version, please use Spring Cli 0.9.0!

Registering Projects

You can register new projects in two ways: by using a project catalog or by providing a name and URL.

The project catalog consists of a collection of projects that can be referenced by name when using the spring boot new and spring boot add commands.

Adding a Project Catalog

To add a project catalog, use the spring project-catalog add command.

In this example, we register a sample catalog that is available at github.com/rd-1-2022/sample-project-catalog.

Within that repository, there is a file named project-catalog.yml. This is the filename for which the command searches. If you wish to use your own URL location, make sure to adjust the contents accordingly. The following listing shows the command:

spring project-catalog add dapr https://github.com/rd-1-2022/sample-project-catalog

The preceding command registers a project catalog named darp from github.com/rd-1-2022/sample-project-catalog using positional parameters.

You can achieve the same result by using the name option, as follows:

spring project-catalog add --name dapr --url https://github.com/rd-1-2022/sample-project-catalog

Now, you can view the available projects in the catalog by running the following command:

spring project list

This command displays a table of projects, and you should see a project named read in the list:

┌─────────────┬──────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────┬───────┬───────────────────────────────────────┐
│Name         │Description                                                       │URL                                                               │Catalog│Tags                                   │
├─────────────┼──────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────┼───────┼───────────────────────────────────────┤
│web          │Hello, World RESTful web service.                                 │https://github.com/rd-1-2022/rest-service                         │gs     │[java-17, boot-3.1.x, rest, web]       │
├─────────────┼──────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────┼───────┼───────────────────────────────────────┤
│jpa          │Learn how to work with JPA data persistence using Spring Data JPA.│https://github.com/rd-1-2022/rpt-spring-data-jpa                  │gs     │[java-17, boot-3.1.x, jpa, h2]         │
├─────────────┼──────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────┼───────┼───────────────────────────────────────┤

...

│read         │Dapr app for reading from a statestore.                           │https://github.com/ciberkleid/dapr-testcontainers?subPath=read-app│dapr   │[java-17, boot-3.1.x, dapr, statestore]│
└─────────────┴──────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────┴───────┴───────────────────────────────────────┘

To create a new project from the read project, use the following command:

spring boot new read-app read

If you want to specify a package name for the project, you can use the --package-name option:

spring boot new read-app read --package-name com.xkcd.read

Adding using a name and URL

If you prefer not to use a project catalog, you can add an individual project by using the spring project add command, as follows:

spring project add read-app --url https://github.com/ciberkleid/dapr-testcontainers?subPath=read-app

After running this command, if you run spring project list, you can see the newly added project in addition to the ones from the catalog.

Now, you can create a new project based on that repository by running the following command:

$ spring boot new my-read-app read-app
Getting project from https://github.com/ciberkleid/dapr-testcontainers?subPath=read-app
Created project in directory 'my-read-app'

Removing Projects and Catalogs

The spring project-catalog remove and spring project remove commands let you remove project catalogs and projects, respectively.