更多信息請從官網獲取https://docs.spring.io/spring-boot/docs/2.0.1.RELEASEweb
1.parent基於本身項目而非spring-boot-starter-parentspring
目前解決方案springboot
(1)全部的springboot依賴顯示寫出版本號maven
(2)plugin顯示寫出執行目標repackageide
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>2.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>2.0.1.RELEASE</version> <scope>test</scope> </dependency> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.0.1.RELEASE</version> <configuration> <classifier>exec</classifier> <executable>true</executable> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
note: <classifier>exec</classifier>該標籤做用是若是有其餘項目依賴該項目時,會打成兩個jar,一個是xxx.jar(別的項目依賴用)另外一個是xxx-exec.jar(部署執行用)spring-boot
2.idea run沒問題,打成jar包執行報資源文件找不到ui
目前解決方案是拷貝一份資源文件到classes目錄下便可idea
<plugin> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/classes</outputDirectory> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin>
若是idea run也報資源文件找不到spa
(1)檢查該文件是否存在resources文件夾內code
(2)檢查resources文件夾是否爲Resources Root 。不然右鍵Mark Directory As --> Resources Root 便可