Maven项目错误:-source 1.5中不支持Diamond / multicatch运算符 [英] Maven project Error: Diamond/multicatch operator not supported in -source 1.5

查看:2253
本文介绍了Maven项目错误:-source 1.5中不支持Diamond / multicatch运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I can't build my maven java web application, because of the following two errors:

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)

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

I'm confused, because i use java 1.8.0 for my project, i never have actually used 1.5

可能导致这个问题的原因是什么?我是如何解决的?

What could be causing this problem and how do i solve it?

我试图在添加下面的内容后构建它pom.xml中的行,但没有成功:

I tried to build it after adding the follwing lines in the pom.xml, but without succes:

 <properties>
        <sourceJdk>1.8</sourceJdk>
        <targetJdk>1.8</targetJdk>
 </properties>


推荐答案

尝试声明 maven-您的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>

这篇关于Maven项目错误:-source 1.5中不支持Diamond / multicatch运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆