How to create/find application jar to deploy your spring boot maven application using embedded tomcat?

836 Views Asked by At

I want to deploy my application using the embedded tomcat in spring -boot. I figured that I have to run the java -jar spring-boot-app.jar command, but I cannot find the jar file for the application anywhere.

On running mvn clean package I am able to generate a war file to deploy externally, how can I do the same with embedded tomcat ?

2

There are 2 best solutions below

0
sidgate On BEST ANSWER

You need to remove following line from pom.xml

<packaging>war</packaging>

or replace war packaging with jar. Make sure you have spring-boot-maven-plugin in maven build plugins

The jar should then be available in target folder

0
javaguy On

To create an executable jar, we need to add the spring-boot-maven-plugin to our pom.xml. To do so, insert the following lines just below the dependencies section:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

For more information,refer this : https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started.html