Creating an executable jar
We can also create an executable jar file that runs in a production environment through a plugin to complete our example.
First, the dependency is introduced:
<build> <plugins> <plugin> <groupid>org.springframework.boot</groupid > <artifactId>spring-boot-maven-plugin</artifactId> <executions> < execution> <goals> <goal>repackage</goal> </goals> </execution > </executions> </plugin> </plugins></build>
Open the cmd command in the project directory and use the MVN Package command as follows:
If you want to view the packaged jar file internal directory, you can use the command jar TVF Target/myproject-0.0.1-snapshot.jar to view the directory structure;
Use Java-jar Target\spring-boot-hello-1.0-snapshot.jar to launch the application as follows:
Test results as shown in 3.4;
If you encounter an error that does not have a master inventory directory at startup, see: http://www.cnblogs.com/lfalex0831/p/8967428.html
Copyright NOTICE: This article for Bo Master original article, reproduced please indicate the source, thank you!
Springboot Creating an executable jar