I am receiving the following error but I am unsure why. I have Java 11 running on the SonarQube server and Java 10 on the build server where the scan is running.
The INFO line below show Java version 1.6. Where is this info coming from? Is this the reason why the error is occuring?
**14:10:45** 14:10:46.429 INFO: Sensor JavaSquidSensor [java] (done) | time=6159ms
**14:10:45** 14:10:46.429 INFO: Sensor PmdSensor [pmd]
**14:10:45** 14:10:46.443 INFO: Execute PMD 6.10.0
**14:10:46
** 14:10:46.764 INFO: Java version: 1.6
**14:10:46
** 14:10:47.185 INFO: PMD configuration: /home/****/jenkins/workspace/NMS.email-delivery-service.PR-OPENED.BUILD/.scannerwork/pmd.xml
**14:10:48
** 14:10:49.111 ERROR: Fail to execute PMD. Following file is ignored: dist/build/rpmbuild/BUILD/email-delivery-service-1.1.1/service/src/main/java/com/intralinks/eds/actors/DataStoreActor.java **14:10:48** net.sourceforge.pmd.PMDException: Error while parsing file:///home/****/jenkins/workspace/NMS.email-delivery-service.PR-OPENED.BUILD/dist/build/rpmbuild/BUILD/email-delivery-service-1.1.1/service/src/main/java/com/intralinks/eds/actors/DataStoreActor.java
**14:10:48** at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:99) **14:10:48** at net.sourceforge.pmd.SourceCodeProcessor.processSourceCode(SourceCodeProcessor.java:51) **14:10:48** at org.sonar.plugins.pmd.PmdTemplate.process(PmdTemplate.java:101)
**14:10:48** at org.sonar.plugins.pmd.PmdExecutor.executeRules(PmdExecutor.java:131)
**14:10:48** at org.sonar.plugins.pmd.PmdExecutor.executePmd(PmdExecutor.java:98)
**14:10:48** at org.sonar.plugins.pmd.PmdExecutor.execute(PmdExecutor.java:80)
**14:10:48** at org.sonar.plugins.pmd.PmdSensor.execute(PmdSensor.java:71)
**14:10:48** at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48) **14:10:48** at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85) **14:10:48** at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
**14:10:48** at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
**14:10:48** at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59) **14:10:48** at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82) **14:10:48** at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) **14:10:48** at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) **14:10:48** at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400) **14:10:48** at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395) **14:10:48** at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358) **14:10:48** at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) **14:10:48** at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) **14:10:48** at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141) **14:10:48** at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) **14:10:48** at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) **14:10:48** at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
**14:10:48** at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) *
*14:10:48** at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
**14:10:48** at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) **14:10:48** at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) **14:10:48** at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
**14:10:48** at java.base/java.lang.reflect.Method.invoke(Method.java:564)
**14:10:48** at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) **14:10:48** at com.sun.proxy.$Proxy0.execute(Unknown Source)
**14:10:48** at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
**14:10:48** at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137) **14:10:48** at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
**14:10:48** at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
**14:10:48** at org.sonarsource.scanner.cli.Main.main(Main.java:61)
**14:10:48** Caused by: net.sourceforge.pmd.lang.java.ast.ParseException: Line 18, Column 55: Cannot use lambda expressions when running in JDK inferior to 1.8 mode!
According to the docs and Jira the latest version of SonarScanner for Maven is 3.6.0. If youâve pinned a specific scanner version in your pom, you should remove it and try again.
Edit: The above is the answer to a different thread
Try executing java -version on the command line. That will give you your default Java version. Another possible source is having a $JAVA_HOME set in the user session thatâs running analysis
Your analysis log snipped doesnât indicate your analysis mode (Maven? Gradle? âŚ) but you should check those settings too.
Iâm probably not going to be able to help you much further in pinning down the source of your misconfiguration, but I do wonder if you still really need Java 6. By deleting (or renaming) that version it might make it clearer where the reference to it is coming from.
Itâs interesting that you appear to have set your Jenkins job to use vanilla SonarScanner analysis. If youâre using Maven or Gradle to build, you probably want to look at using them to analyze as well. And then you just have to figure out which Java Maven or Gradle is using.
As I said, Iâm probably not going to be able to help you track down where/how youâre configured to use Java 6 for analysis. But I can point out that it appears that the PMD plugin is the one erroring out analysis, so failing all else, you could uninstall it.