2

I am unable to execute sonar analysis for PMD. I have installed a plugin for pmd (sonar-pmd-plugin-3.2.1.jar) manually and restarted the sonarqube. triggered jenkins build for the pmd analysis where it throw the error, unsupported java version for pmd. Please find snippet for reference.

Jenkins build failed for PMD analysis in sonarqube

Here are details for the plugins I have used:

SonarQube : 7.1
Jenkins : 2.164
PMD plugin : sonar-pmd-plugin-3.2.1.jar (manually placed under extensions folder in SonarQube)
Java Plugin: sonar-java-plugin-5.2.0.13398.jar (under extensions folder in SonarQube)
Sonar scanner: sonar-scanner-4.2.0.1873-linux
JDK : 1.8

Work around:

  • Have tried adding below both entries in sonar-scanner.properties file.

    sonar.java.source=1.8
    sonar.java.source=8
    
  • Have changed multiple plugins for PMD and JAVA under SonarQube, here are the reference of plugin versions:

    tried java plugins

    tried PMD plugins

I have attached the Jenkins build logs.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Apr 10 '20 at 11:56
  • Attaching screenshots of text instead typing (or pasting) the same text into the questions may seem to be a nice shortcut but it also means that your question is harder to find via web search. – Attila Csipak Apr 10 '20 at 16:59
  • @AttilaCsipak: it also causes problems with clipboards and screen-readers. – halfer Apr 10 '20 at 17:42
  • The exception message comes from here: https://github.com/jensgerdes/sonar-pmd/blob/94bf6862f8d216979ea38a74bda70365e31862b5/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdTemplate.java#L83 It should display the version, that is not supported - but the screenshot doesn't show anything. This suggests a problem in the configuration - `sonar.java.source` is set to a empty string or not set at all.... See also https://github.com/jensgerdes/sonar-pmd – adangel Apr 11 '20 at 08:23
  • Add information how you execute the analysis, please. – agabrys Apr 12 '20 at 10:18
  • That plugin is shipping a dated version of PMD (6.10.0 vs 6.22.0), over a year old. It doesn't support Java 12 and later. However, Java 8 should be supported. Please check that Maven is actually compiling the sources for target 1.8 by adding the properties `1.8` and `1.8` – Johnco Apr 12 '20 at 17:40

0 Answers0