通过maven-install把springboot的maven项目打包成jar包后,用命令行运行jar文件
F:\>java -jar springboot-test-0.0.1-SNAPSHOT.jar
springboot-test-0.0.1-SNAPSHOT.jar中没有主清单属性
被提示没有主清单属性
1.解决方法
调用maven的插件,完成main方法的指定,springboot有专门为maven提供了打包springboot的所有插件简化资源。在pom.xml中添加springboot对maven插件的支持资源
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
显示截图
2.原因
没有添加支持前,项目jar找不到主清单属性即main方法所在类。