Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to create executable jar including dependencies out of your springboot app

In the pom.xml, include the below plugin

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
            <configuration>
                <mainClass>com.baeldung.webjar.WebjarsdemoApplication</mainClass>
            </configuration>
        </execution>
    </executions>
</plugin>



Now we can run our example war with two simple commands:

$ mvn clean package spring-boot:repackage
$ java -DyourSystVar="yourSystVarVal" -jar targetyourbuiltjar.jar

Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #create #executable #jar #including #dependencies #springboot #app
ADD COMMENT
Topic
Name
9+4 =