Java Maven项目错误:源代码1.5中不支持菱形/多批次运算符
由于以下两个错误,我无法构建maven java web应用程序:Java Maven项目错误:源代码1.5中不支持菱形/多批次运算符,java,maven,web,diamond-operator,multi-catch,Java,Maven,Web,Diamond Operator,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 statemen
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)
我很困惑,因为我在我的项目中使用了Java1.8.0,我从来没有实际使用过1.5
是什么导致了这个问题?我该如何解决它
在pom.xml中添加以下行后,我尝试构建它,但没有成功:
<properties>
<sourceJdk>1.8</sourceJdk>
<targetJdk>1.8</targetJdk>
</properties>
1.8
1.8
尝试在pom中声明maven编译器插件
<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>
org.apache.maven.plugins
maven编译器插件
3.1
1.8
1.8
您也可以通过将其包含在pom.xml中,以这种方式添加它
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
1.7
1.7
是的,这是可行的,但现在我有一大堆其他错误需要解决;(