Maven项目错误:-source 1.5中不支持Diamond/multicatch运算符

Mee*_*tat 11 java diamond-operator maven web multi-catch

由于以下两个错误,我无法构建我的maven java Web应用程序:

diamond operator is not supported in -source 1.5
  (use -source 7 or higher to enable diamond operator)

multi-catch statement is not supported in -source 1.5
  (use -source 7 or higher to enable multi-catch statement)
Run Code Online (Sandbox Code Playgroud)

我很困惑,因为我使用java 1.8.0作为我的项目,我从来没有实际使用过1.5

在此输入图像描述

在此输入图像描述

什么可能导致这个问题,我该如何解决?

我在pom.xml中添加了以下行后尝试构建它,但没有成功:

 <properties>
        <sourceJdk>1.8</sourceJdk>
        <targetJdk>1.8</targetJdk>
 </properties>
Run Code Online (Sandbox Code Playgroud)

sse*_*ano 16

尝试maven-compiler-plugin在你的pom中声明.

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
Run Code Online (Sandbox Code Playgroud)