https://blog.csdn.net/ztx114/article/details/74750650

jdk明明是1.8满足Dynamic Web Module 3.1的要求可还是报错Dynamic Web Module 3.1 requires Java 1.7 or newer

有时还会报错cannot change version web module 2.5

如果你改了org.eclipse.wst.common.project.facet.core.xml改为

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <faceted-project>  
  3.   <fixed facet="wst.jsdt.web"/>  
  4.   <installed facet="java" version="1.8"/>  
  5.   <installed facet="jst.web" version="3.1"/>  
  6.   <installed facet="wst.jsdt.web" version="1.0"/>  
  7. </faceted-project

还是不行的话,可是试试在pom.xml加上

       <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>

在maven的settings.xml加上或者修改

<profile>
      <id>jdk-1.8</id>

      <activation>
        <jdk>1.8</jdk>
      </activation>

  <profiles>
      <profile>
      <id>jdk-1.8</id>

      <activation>
          <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
      </activation>

      <repositories>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </repositories>
  </profile>