0

I am facing an issue with the jenkins build in one of our servers.

Issue is :

[ERROR] PATH_TO_FILE/EventsServiceImpl.java:[1592,137] method references are not supported in -source 1.5

enter image description here

EventsServiceImpl.java:[1592,137] contains the following code.

List<String> androidDevicesList = deviceIds.getDeviceIds().stream().map(Object::toString)
                                    .collect(Collectors.toList());

By the looks of the issue, it is saying that the jenkins build is taking 1.5 to build the code. where the above code needs java 8 to compile. I have done everything to set the path correctly. I have checked the $JAVA_HOME path in the server. And it points to the correct JRE version. i.e. 1.8.0_111

I also checked my Jenkins JDK path and it is correct as far as I knew.

enter image description here

It is working fine in my local system. My Eclipse compiles it without any issue. But if I change the java compiler from 1.8 to 1.7 / 1.5, it is throwing the error.

My System Config:

OS: Windows 7

JDK: 8

JRE: 1.8.0_31

Server Configurations:

OS: Cent OS 7

JDK: 8

JRE: 1.8.0_111

I don't know, exactly what is the issue? Is it the issue with Jenkins? or is it the issue with Java compiler path in the server? Or is it the issue with Mavan in the server.

And also I have ran sample java file in the server with the above code in it. I ran without any issue. I am able to compile the code and build the code and saw the output.

4

1 回答 1

1

“-source 1.5”表示 java 编译器,即使是 JDK 8,也被告知在 JDK 5 级别编译代码。鉴于发布的信息,无法确定这是从哪里来的。请发布您的 pom.xml 文件或检查它(有关更多信息,请参阅此内容)以获取

<source>

标签。还要检查 Jenkins 项目配置的 Build 部分,以确保它没有被设置为命令行选项。

于 2017-01-12T17:14:55.707 回答