SpringBoot将项目打包成jar包
- 首先在pom.xml文件中导入Springboot的maven依赖;
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>org.orderService.App</mainClass>
<!-- <layout>ZIP</layout> <classifier>exec</classifier> -->
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
<!-- 打运行jar,如果只要应用包不需要加 -->
</goals>
<!-- 分离出代码包 <configuration> <classifier>exec</classifier> </configuration> -->
</execution>
</executions>
</plugin>
</plugins>
</build>
- 项目右击-> Run As -> Maven build
- 开始下载相应的包直到build成功
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom
[INFO] Downloaded from : https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom (7.3 kB at 13 kB/s)
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
[INFO] Downloaded from : https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 36 kB/s)
[INFO] Downloading from : https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar
[INFO] Downloaded from : https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 22 kB/s)
[INFO] Installing D:\workspace\Demo\MallSysParent\OrderService\target\OrderService-0.0.1-SNAPSHOT.jar to C:\Users\libh.ext\.m2\repository\MallSysParent\OrderService\0.0.1-SNAPSHOT\OrderService-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\workspace\Demo\MallSysParent\OrderService\pom.xml to C:\Users\libh.ext\.m2\repository\MallSysParent\OrderService\0.0.1-SNAPSHOT\OrderService-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:28 min
[INFO] Finished at: 2019-12-23T18:24:55+08:00
成功后会在target 文件夹下生成 xxxx-SNAPSHOT.jar