springboot项目搭建1032-springboot打包-没有主清单属性

资源贴:https://blog.csdn.net/u010429286/article/details/79085212

项目地址:https://github.com/wenrongyao/springboot-demo.git

摘要:springboot项目打成jar包运行时出现没有主清单属性的解决办法。

导致原因:使用maven打出来的包不符合springboot的规划,需要增加springboot maven插件

1、maven 的package命令打出的jar包

springboot项目搭建1032-springboot打包-没有主清单属性

springboot maven插件打出的jar包

springboot项目搭建1032-springboot打包-没有主清单属性

关于springboot的打出包的具体信息,可以参看资源贴

2、解决办法,加入springboot maven插件

<build>
        <!--包名,默认是${artifactId}-${version}-->
        <finalName>springboot-demo</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>