1、打开新建的servlet文件例如(hibernate.cfg.xml)修改头文件为
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
2、打开项目所在目录下的.settings文件夹
2.1修改项目的设置,打开项目.settings目录下的org.eclipse.jdt.core.prefs(打开工具例如NOTEPAD )
把1.5改成1.8,例如:
1 eclipse.preferences.version=1
2 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 org.eclipse.jdt.core.compiler.compliance=1.8
5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 org.eclipse.jdt.core.compiler.source=1.8
2.2打开org.eclipse.wst.common.project.facet.core.xml
把<installed facet="java" version="1.5"/>改成<installed facet="java" version="1.8"/>,把 <installed facet="jst.web" version="2.3"/>改成 <installed facet="jst.web" version="3.0"/>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <faceted-project>
3 <fixed facet="wst.jsdt.web"/>
4 <installed facet="jst.web" version="3.0"/>
5 <installed facet="wst.jsdt.web" version="1.0"/>
6 <installed facet="jboss.m2" version="1.0"/>
7 <installed facet="java" version="1.8"/>
8 <installed facet="jst.cdi" version="1.0"/>
9 </faceted-project>
3、打开存放依赖的pom.xml文件,修改最下面的
<build>
<finalName>D5.22hotai</finalName>
</build>
为
1 <build>
2 <finalName>D5.22hotai</finalName>
3 <plugins>
4 <plugin>
5 <groupId>org.apache.maven.plugins</groupId>
6 <artifactId>maven-compiler-plugin</artifactId>
7 <version>3.3</version>
8 <configuration>
9 <!-- 指定source和target的版本 -->
10 <source>1.8</source>
11 <target>1.8</target>
12 </configuration>
13 </plugin>
14 </plugins>
15 </build>
4、重启eclipse或者右键选中工程maven→ Update Project...
更多专业前端知识,请上 【猿2048】www.mk2048.com