問題:SpringBoot打包成jar後運行提示沒有主清單屬性html
解決:補全maven中的bulid信息spring
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
緣由:maven
由於我使用spring-boot-dependencies這個BOM代替了spring-boot-starter-parent這個parent POM(詳見13.2.2. Using Spring Boot without the parent POM)spring-boot
致使spring-boot-maven-plugin的配置項丟失,使得打包後的jar中的MANIFEST.MF文件缺乏Main-Class。spa
PS: 當打包類型爲jar時,spring-boot-maven-plugin的打包過程與直接使用maven-jar-plugin徹底不一樣。生成的jar目錄結構也有很大不一樣...code