1:Maven项目,右键-update project后报错
解决办法:在pom.xml配置文件中加入如下语句:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7(修改成自己JDK的版本)</source>
<target>1.7(修改成自己JDK的版本)</target>
</configuration>
</plugin>
</plugins>
2:报错:Cannot change version of project facet Dynamic Web Module to 3.0
1)修改\WEB-INF\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"
version="3.0">
<display-name>Archetype Created Web Application</display-name>
</web-app>
2)修改org.eclipse.jdt.core.prefs
1.8
3)修改org.eclipse.wst.common.component
1.8.0
4)修改org.eclipse.wst.common.project.facet.core.xml
3.1
5)配置maven setting.xml
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
6)修改项目pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
7)Maven->Update Project
3:加载到tomcat容器中,修改pom.xml
<build>
<finalName>hunhr</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<container>
<containerId>tomcat8</containerId>
<home>F:\Tools\apache-tomcat-8.0.53</home>
</container>
<configuration>
<type>existing</type>
<home>F:\Tools\apache-tomcat-8.0.53</home>
</configuration>
</configuration>
<executions>
<execution>
<id>cargo-run</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>