-描述:前段时间在做公司的一个项目,springboot2.0+jdk1.8+maven,项目完成后打包丢到测试环境测试时,发现无法通过controller跳转到相应的页面,逐一排查发现,通过maven打包springboot时,webapp下的页面并没有被打包进去,以至于页面无法访问,在网上查了一下,需要在pom.xml文件中作相应修改如下:
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
这样就可以顺利的将前端页面代码打包到src/main/webapp资源目录下。
但在解决这个问题时,打包的maven版本必须是1.4.2.RELEASE才能成功,其它版本做了尝试,不行。不确定是否由于版本冲突的缘故。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.4.2.RELEASE</version>
</plugin>
如有知道原因的大佬,还请告知,先行谢过~