You can also generate a project in a shell using cURL
or HTTPie
. To discover the
available options of a particular instance, simply "curl it", i.e. if you have curl
installed invoke curl start.spring.io
on the command-line (or alternatively
http start.spring.io
if you prefer to use HTTPie
).
The result is a textual representation of the capabilities of the service that are split in three sections:
First, a table that describes the available project’s types. On the default instance,
you’ll find the maven-project
and gradle-project
we’ve discussed above but you’ll
also be able to generate only a build script rather than an entire project.
Then, a table that describes the available parameters. For the most part, these are the same options as the ones available in the web UI. There are, however, a few additional ones:
applicationName
can be used to define the name of the application, disabling the
algorithm that infer it based on the name
parameterbaseDir
can be used to create a base directory in the archive so that you can extract
the generated zip without creating a directory for it firstFinally, the list of dependencies are defined. Each entry provides the identifier that you’ll have to use if you want to select the dependency, a description and the Spring Boot version range, if any.
Alongside the capabilities of the service, you’ll also find a few examples that help you understand how you can generate a project. These are obviously tailored to the client that you are using.
Let’s assume that you want to generate a "my-project.zip" project based on Spring Boot
1.5.2.RELEASE
, using the web
and devtools
dependencies (remember, those two ids are
displayed in the capabilities of the service):
$ curl https://start.spring.io/starter.zip -d dependencies=web,devtools \ -d bootVersion=1.5.2.RELEASE -o my-project.zip
If you extract my-project.zip
, you’ll notice a few differences compared to what happens
with the web UI:
my-project
(the -o
parameter has no impact on the
name of the project)The exact same project can be generated using the http
command as well:
$ http https://start.spring.io/starter.zip dependencies==web,devtools \ bootVersion==1.5.1.RELEASE -d
Note | |
---|---|
|