统一解决Maven创建动态Web项目后产生的版本不匹配。
1:问题如下
2:解决方法
- Go to project Build Path and change the Java Library version to 1.7
删除原先的低版本JRE
增加系统默认1.7版本的JRE
Eclipse Preferences -> Java -> Compilre -> Change compliance level to 1.7
在项目上单机右键 -> Properties -> Project Facets
取消选中 Dynamic Web Module 状态,点击 Apply
将 Java facet 版本变为 1.7 ,点击 Apply
将 Dyanmic Web Module 版本更改为3.0, 点击 Apply.
在 Pom 中添加下面 build 配置。
<build>
<finalName>项目名称</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
- maven->update
注意
一定最后要将Java Server 和 JAX-RS勾选上,不然项目中缺失web.xml