配置maven compiler的时候加上对应的Servlet版本号即可解决。
[html] view plain copy
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <!-- 与Servlet版本对应 -->
- <version>3.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
文章转自:http://blog.csdn.net/huwei0518/article/details/45054803