Skip to main content

Command Palette

Search for a command to run...

Creation of jar in Spring Boot

Published
1 min read

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>

mvn package

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

8 views

More from this blog

C

Coding Saint - Simple Short Tutorials

52 posts

I am Kumar Pallav, a passionate programmer.I love java, open source & microservices . I create Simple , Short Tutorials Follow me at https://twitter.com/kumar_pallav