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
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.
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.