Dynamic Web Module 3.0 requires Java 1.6 or newer.

查看 Java Build Path

JRE System Libaray [J2SE-1.4]

问题如上,解决方法是提高版本。

问题引起原因:

使用maven 时,pom.xml 指定的source 和 target 不存在时,则默认最低版本。

现场:

case1

pom.xml

<!-- build -->
    <build>
        <finalName>${project.artifactId}</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>
                </configuration>
            </plugin>

     

case2:

> Java Build Path

> JRE System Libaray [J2SE-1.4]

case3:

Java Compiler 1.7

Java Installed JREs jdk1.7.x

Apache Tomcat v7.0

处理方案

降低source 与 target

or

升级jdk

备注:

如需修改pom.xml 文件,则应 update maven project 。 坐等 Validating xxx:(0%)

附:

pom.xml 文件中的插件

官方网站使用说明:http://maven.apache.org/plugins/maven-compiler-plugin/usage.html

官方网站使用说明:http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

For example, if you want to enable assertions (-source 1.4) and also want the compiled classes to be compatible with JVM 1.4 (-target 1.4), you can then put:

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.2</version>
        <configuration>
          <source>1.4</source>
          <target>1.4</target>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>
原文地址:https://www.cnblogs.com/zno2/p/4496474.html