因为写项目用maven管理项目,但是项目建立后总是显示低版本,自己有很懒不愿意从源头去改每次使用下面的方法,为了以后查阅方便特此记录
解决这个问题的步骤如下:
1. 把Servlet改成3.0,打开项目的web.xml
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
web-app
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns
=
"http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation
=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id
=
"schedule-console"
version
=
"3.0"
>
2. 修改项目的设置,在Navigator下打开项目.settings目录下的org.eclipse.jdt.core.prefs
把1.5改成1.8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
3. 打开org.eclipse.wst.common.project.facet.core.xml
把java改为1.8, 把jst.web改为3.0;
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
faceted-project
>
<
fixed
facet
=
"wst.jsdt.web"
/>
<
installed
facet
=
"jst.web"
version
=
"3.0"
/>
<
installed
facet
=
"wst.jsdt.web"
version
=
"1.0"
/>
<
installed
facet
=
"java"
version
=
"1.8"
/>
</
faceted-project
>
OK,搞定了。