更多信息请从官网获取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 便可