- 添加打包插件依赖并且配置主类,如果引入外部jar包,一定要加
<includeSystemScope>true</includeSystemScope>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 引入外部jar包 一定要写下面的这句话,否则报错-->
<includeSystemScope>true</includeSystemScope>
<!-- 工程主入口 -->
<mainClass>com.jiuqi.gmc.mobile.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
- 项目右键run as–>maven install,控制台出现BUILD SUCCESS即为成功
- 成功后,刷新target目录,将jar包复制到服务器
- java -jar xxx.jar运行jar包
成功!