Sonar Source Scanner Maven Plugin


Any idea on this issue ?
Tried to added specific plugin version in POM.xml
Changed version

For the pipeline, I am using agent i.e. docker image “maven:3.6-jdk-13-alpine”

Welcome :slight_smile:

Don’t know if Sonarqube Maven plugin is Java 13 ready !?
Try with Java 8.

Gilbert

Do we need to use a specific stage for the sonarQube source ?

So your mvn build runs via Jenkins pipeline ?
Every pipeline dsl method has to run within a stage or node scope.
It’s all in sonarqube documentation, see
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/ / SonarScanner for Maven
for a working snippet.

Already tried with the documentation provided in sonarQube community but couldn’t go through. Assuming to add a specific stage in Jenkins pipeline script with a separate node (Java 8) for SonarQube stage.
Does this works ?

Running the Sonarqube scan on another Jenkins node running with Java 8 should work.
You may set the jdk version for mvn sonar:sonar via withMaven(jdk: …) e.g.

withSonarQubeEnv(sonarenv) {
  withMaven(jdk: "${p.javaVersion}", maven: "${p.mvnVersion}", globalMavenSettingsConfig: genericMvnSettings()) {
    genericSh("mvn sonar:sonar ${sqProjectVersion ? "-Dsonar.projectVersion=$sqProjectVersion" : ''} -Dsonar.branch.name=${BRANCH_NAME}")
  }
}

Hi @venkatesh2208,

Could you run maven with the full stack trace (-e) or full debug logging (-X) and provide us more detail (stack trace) about the above ExceptionInInitializerError?

I successfully analyzed a java 13 project using AdoptOpenJDK 13.0.2 and Maven 3.6 (that downloaded sonar-maven-plugin:3.7.0.1746). I used a released version of a JDK 13 and not an early-access build, could you also try with a released version?