原因是IDEA编译java文件只把.class文件放到target目录下,而不会把静态文件加入。
解决办法:在pom文件中加入resources标签
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.*</include> </includes> <excludes> <exclude>**/*.java</exclude> </excludes> </resource> </resources> </build>