Creation of jar in Spring Boot
Creating a JAR
In Spring Boot application , inside pom file we have following build dependency which enables our application to create a JAR.
The above plugin helps maven to build a runnable JAR. In order to do so , type maven package command from prompt and a jar will be build.
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
In above screenshot , we can see that a jar is build at target folder. We can run the Jar and even ship it as standalone application. It has embedded tomcat, so we don’t require a separate tomcat instance to deploy it.
To run it as standalone application run with command :-
java -jar user-service-0.0.1-SNAPSHOT.jar