版权声明:转载请注明出处 https://blog.csdn.net/baidu_25104885/article/details/90269099
需要添加插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.9.RELEASE</version>
</plugin>
packaging标签里为jar
<groupId>com.lahhass</groupId>
<artifactId>seckill_idea</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
执行命令
mvn clean package
或
mvn install
target目录下生成jar包,打开如图
META-INF下的MANIFEST.MF文件需要有如下信息
Manifest-Version: 1.0
Implementation-Title: seckill_idea
Implementation-Version: 1.0-SNAPSHOT
Built-By: Administrator
Implementation-Vendor-Id: com.lahhass
Spring-Boot-Version: 1.5.9.RELEASE
Implementation-Vendor: Pivotal Software, Inc.
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.lahhass.seckill.MainApplication
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_51
Implementation-URL: http://www.example.com
可能发生的问题:没有BOOT-INF文件夹,MANIFEST.MF文件没有主清单属性
解决方法:将外层的pluginManagement标签去掉,mvn clean后再生成jar包