标签:amp span sample start 清单 lib inf ase 添加
使用mvn package打jar包,运行java -jar XXX.jar的时候报错:jar中没有主清单属性。
解决办法:
pom.xml中添加
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
再次运行mvn package之后,即可正常运行。
PS:
jar包多了BOOT-INF文件夹,里面包含class和依赖项。而且META-INF\MANIFEST.MF文件由
Manifest-Version: 1.0 Implementation-Title: restsample Implementation-Version: 1.0-SNAPSHOT Built-By: ZJ Implementation-Vendor-Id: com.myproject Created-By: Apache Maven 3.3.9 Build-Jdk: 1.8.0_161 Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo ot-starter-parent/restsample
变为
Manifest-Version: 1.0 Implementation-Title: restsample Implementation-Version: 1.0-SNAPSHOT Built-By: ZJ Implementation-Vendor-Id: com.myproject Spring-Boot-Version: 2.0.5.RELEASE Main-Class: org.springframework.boot.loader.JarLauncher Start-Class: com.myproject.restsample.RestSampleClass Spring-Boot-Classes: BOOT-INF/classes/ Spring-Boot-Lib: BOOT-INF/lib/ Created-By: Apache Maven 3.3.9 Build-Jdk: 1.8.0_161 Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo ot-starter-parent/restsample
参考:
https://blog.csdn.net/u010429286/article/details/79085212
Spring boot: 运行maven打包的jar包报错-jar中没有主清单属性
标签:amp span sample start 清单 lib inf ase 添加
原文地址:https://www.cnblogs.com/jane850113/p/10190510.html