Not possible to analyze Project

Hi

  • Bitbucket Cloud
  • CI system used (Bitbucket Cloud
  • Java

Trying to analyze my Project using following configuration:
Selected Manually–>Maven to analyse my project,
but during the build it fails with following error:
Any hint what the reason is.

During the  to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project XXX: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/sonar/batch/bootstrapper/EnvironmentInformation, offset=6

Hi
I found the root cause, My java is not version 11 which is required to analyze.
Are they not support for earlier Java versions?

1 Like

Hi,

Welcome to the community and congrats on working through this!

To answer your question, analysis need Java 11 or 17.

 
Ann

Even that I Changes to Java Version I am facing following.

 Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/sonar/batch/bootstrapper/EnvironmentInformation, offset=6
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/D:/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar
[ERROR] urls[1] = file:/C:/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/C:/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/C:/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/C:/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar
[ERROR] urls[5] = file:/C:/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]

java -version
openjdk version “11.0.3” 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7)

According to the Documentation JAVA_HOME can be overridden just before the analysis.

I did also tried it, but it still failing when the analysis start.

I am executing following in commands in the same Command Window.

set JAVA_HOME=C:/programmes/JDK_1.8

mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=XXXXX

I have also deleted sonar related dependencies to before executing above commands.
My project is build successfully, any

Any hint what I am missing.

Hi,

This

is still a version error. Likely caused by this:

since analysis no longer supports (running on) Java 8.

 
HTH,
Ann

Hi
So it is not possible to analyze a Project built on Java 8 with Sonarcloud.
Is not possible to configure Sonacloud to build the Project with Java 8 and make the analysis with the supported Java version.

Hi,

You can build with - or to - any version you like. But you need to analyze with Java 11.

 
HTH,
Ann

Hi
I had tried to build with Java 8 and analyze with Java 11 performing following steps.

  1. Changed to Java 8
  2. Build the Project with the command ‘mvn clean install’
  3. Changed to Java 11
  4. Executed the command to analyze the Project.

mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=XXXXX

What I am missing?

Hi,

It looks like your switch to Java 11 isn’t happening. I suspect you’ll need to dig into this on the Bitbucket Cloud side.

 
HTH,
Ann

Hi

I am executing the command locally on my machine, so how can it be on the Bitbucket Cloud side?.

Hi,

I was basing that off your OP:

 
Ann

So any other suggestions?.

Hi,

I’m back to:

Because I can only go by the error message.

 
Ann

Hi
A little progress analyzing the project, but now it is failing with missing key and organisation, even that is included in the command

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project XXX: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator

Hi,

You’ve long since marked this thread solved and the question has evolved. You should create a new thread.

 
Thx,
Ann

I will do thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.