-source 1.6不支持multi-catch语句(使用-source 7或更高版本来启用multi-catch语句) [英] multi-catch statement is not supported in -source 1.6 (use -source 7 or higher to enable multi-catch statement)

查看:626
本文介绍了-source 1.6不支持multi-catch语句(使用-source 7或更高版本来启用multi-catch语句)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven 3.3.9在Jenkins上运行编译.我在某些代码上收到此错误,但不是全部:

I am running a compilation on Jenkins using maven 3.3.9. I get this error on some code but not all:

multi-catch语句 (使用-source 7或更高版本来启用多捕获语句)

multi-catch statement is not supported in -source 1.6 (use -source 7 or higher to enable multi-catch statement)

我正在使用Java 8进行编译:

I am compiling with Java 8:

执行Maven:-B -f/opt/jenkins/workspace/product/product-Content-Operations_RELEASE/pom.xml -s/opt/jenkins/maven/settings.xml干净部署-U -X -rf:crawlers -模块

Executing Maven: -B -f /opt/jenkins/workspace/product/product-Content-Operations_RELEASE/pom.xml -s /opt/jenkins/maven/settings.xml clean deploy -U -X -rf :crawlers-module

Apache Maven 3.3.9(bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)

Maven主页:/opt/apache-maven-3.3.9

Maven home: /opt/apache-maven-3.3.9

Java版本:1.8.0_92,供应商:Oracle Corporation

Java version: 1.8.0_92, vendor: Oracle Corporation

Java主页:/usr/java/jdk1.8.0_92/jre

Java home: /usr/java/jdk1.8.0_92/jre

默认语言环境:en_US,平台编码:ANSI_X3.4-1968

Default locale: en_US, platform encoding: ANSI_X3.4-1968

操作系统名称:"linux",版本:"2.6.18-371.el5",拱门:"amd64",家族:"unix"

OS name: "linux", version: "2.6.18-371.el5", arch: "amd64", family: "unix"

我已经从命令行验证了它正在使用Java 8.

I have verified that it is using Java 8 from the commandline.

有人解决过这个问题吗?我很沮丧.

Has anyone worked around this? I am stumped.

推荐答案

猜测:在编译设置的某个深处,您实际上是强制 -source 1.6

Guessing: somewhere deep in your compile settings, you are actually forcing -source 1.6

所以,是的,您正在使用JDK 1.8;但是您的设置希望将自身限制为Java 1.6;当然那是行不通的;因为对于Java 1.6,多捕获"是太新了".

So, yes, you are using a JDK 1.8; but your setup wants to restrict itself to Java 1.6; and that of course does not work; as "multi-catch" is "too new" for Java 1.6.

因此,我将开始在您的构建配置(和输出)文件中搜索完全像"1.6"之类的字符串.

So I would start searching for exactly strings like "1.6" in your build configuration (and output) files.

这篇关于-source 1.6不支持multi-catch语句(使用-source 7或更高版本来启用multi-catch语句)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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