For the latest stable version, please use Spring Cli 0.9.0! |
Initializr
You can use Spring CLI as a client for github.com/spring-io/initializr and defaults to start.spring.io. Shell style project creation mimics how a project is created from the UI. The following image shows an example of it:
New Command
To use the new
command, define options on the command line.
Then, if Initializr needs more information, it goes into its interactive mode to ask clarifying questions.
NAME
initializr new - Create a new project from start.spring.io
SYNOPSIS
initializr new --server-id String --path String --project String --language String --boot-version String
--version String --group String --artifact String --name String --description String --package-name String
--dependencies List --packaging String --java-version String
OPTIONS
--server-id String
Server to use
[Optional]
--path String
Path to extract
[Optional]
--project String
Project
[Optional]
--language String
Language
[Optional]
--boot-version String
Language
[Optional]
--version String
Version
[Optional]
--group String
Group
[Optional]
--artifact String
Artifact
[Optional]
--name String
Name
[Optional]
--description String
Description
[Optional]
--package-name String
Package Name
[Optional]
--dependencies List
Dependencies
[Optional]
--packaging String
Packaging
[Optional]
--java-version String
Java
[Optional]
The following example shows all the options being provided and the command just passing through without anything being asked.
$ spring initializr new \
--path demo \
--project gradle-project \
--language java \
--boot-version 2.7.0 \
--version 0.0.1-SNAPSHOT \
--group com.example \
--artifact demo \
--name demo \
--description "Demo project" \
--package-name com.example.demo \
--dependencies web \
--packaging jar \
--java-version 17
List Command
You can use the list
command to see the custom initializr servers you have defined:
$ spring help initializr list
NAME
initializr list - Show the Initializr server environments
SYNOPSIS
initializr list
If you have defined one custom Initializr,the output resembles the following:
$ spring initializr list
┌────────┬─────────────────────┐
│ServerId│Url │
├────────┼─────────────────────┤
│local │http://localhost:8080│
└────────┴─────────────────────┘
Set Command
You can use the set
command to define a new server environment:
NAME
initializr set - Set the Initializr server environment
SYNOPSIS
initializr set [--server-id String] [--url String]
OPTIONS
--server-id String
Server to use
[Mandatory]
--url String
Server base url
[Mandatory]
You can, for example, define your local initializr server, as follows:
$ spring initializr set --server-id local --url http://localhost:8080
Remove Command
You can use the remove
command to remove a server environment:
$ spring help initializr remove
NAME
initializr remove - Remove the Initializr server environment
SYNOPSIS
initializr remove [--server-id String]
OPTIONS
--server-id String
Server to use
[Mandatory]
You can, for example, remove your local initializr server, as follows:
$ spring initializr remove --server-id local
Dependencies Command
You can use the dependencies
command to list and search initializr dependencies:
$ spring help initializr dependencies
NAME
initializr dependencies - List supported dependencies
SYNOPSIS
initializr dependencies --server-id String --search String --version String
OPTIONS
--server-id String
Server to use
[Optional]
--search String
Search string to limit results
[Optional]
--version String
Limit to compatibility version
[Optional]
You can, for example, search initializr server, as follows:
$ spring initializr dependencies --search webflux
┌───────┬───────────────────┬──────────────────────────────────────────────────────────────┬────────────────┐
│Id │Name │Description │Required version│
├───────┼───────────────────┼──────────────────────────────────────────────────────────────┼────────────────┤
│webflux│Spring Reactive Web│Build reactive web applications with Spring WebFlux and Netty.│ │
└───────┴───────────────────┴──────────────────────────────────────────────────────────────┴────────────────┘