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

Registering Projects

You can register new projects in two ways: 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 using a Project Catalog

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

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

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

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

The command above registers a Project Catalog named darp from the URL github.com/rd-1-2022/sample-project-catalog using positional parameters.

You can achieve the same result using named options 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 command:

spring project list

This will display a table of projects, and you should see a project named read in the list.

spring project list

That returns the following table

┌─────────────┬──────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────┬───────┬───────────────────────────────────────┐
│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 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 using the spring project add command. For example:

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

After running the above command, if you execute spring project list, you will 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 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 project and catalogs

The commands spring project-catalog remove and spring project remove let you remove Project Catalogs and Projects.