spring cli version
Open a terminal window.
Navigate to the directory where you want to create your Spring project.
Run the following command to generate a new Spring Boot project using the Spring Initializr:
spring init --dependencies=<comma-separated-dependencies> <project-name>
Replace<comma-separated-dependencies>
with the desired Spring Boot dependencies, and<project-name>
with the desired name for your project.Navigate to the newly created project directory:
cd <project-name>
Open the project in your preferred Integrated Development Environment (IDE).
Build the project using the following command:
./mvnw clean install
or for Windows:mvnw.cmd clean install
Run the Spring Boot application:
./mvnw spring-boot:run
or for Windows:mvnw.cmd spring-boot:run
Access the application by navigating to
http://localhost:8080
in your web browser.Optionally, customize your application code in the IDE, and repeat steps 6 and 7 as needed.
To package the application as a JAR file, use the following command:
./mvnw clean package
or for Windows:mvnw.cmd clean package
The packaged JAR file can be found in the
target
directory.Deploy the JAR file to a server or cloud platform of your choice.