Initialize a Spring boot application using command line
Problem definition
start.spring.io website provides a simple interface to initialize new Spring boot application and even browse the code before downloading the generated project. But, imagine there is need to automate this process then using a command line tool is really helpful.
Using command line
It is possible to use curl or httpie to generate the project in command line. In this article httpie is used.
Install httpie
Install httpie by following the installation documentation.
sudo apt install httpie
Generate projects
To see the help for command line run the following command:
http https://start.spring.io
To create a Java 11 project with groupId com.outadi.siavash and artifactId my-spring-app with data jpa and web support in my-app directory run the following command:
http https://start.spring.io/starter.tgz groupId==com.outadi.siavash \
artifactId==my-spring-app \
dependencies==web,data-jpa \
javaVersion==11 \
baseDir==my-app | tar -xzvf -