miq
(smc)
February 22, 2023, 3:18pm
1
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
miq
(smc)
February 23, 2023, 8:56am
2
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
ganncamp
(G Ann Campbell)
February 23, 2023, 3:48pm
3
Hi,
Welcome to the community and congrats on working through this!
To answer your question, analysis need Java 11 or 17 .
Ann
miq
(smc)
February 24, 2023, 9:56am
4
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)
miq
(smc)
February 24, 2023, 2:04pm
5
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.
ganncamp
(G Ann Campbell)
February 24, 2023, 4:25pm
6
Hi,
This
is still a version error. Likely caused by this:
since analysis no longer supports (running on) Java 8.
HTH,
Ann
miq
(smc)
February 25, 2023, 3:27pm
7
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.
ganncamp
(G Ann Campbell)
February 27, 2023, 1:16pm
8
Hi,
You can build with - or to - any version you like. But you need to analyze with Java 11.
HTH,
Ann
miq
(smc)
February 28, 2023, 6:41am
9
Hi
I had tried to build with Java 8 and analyze with Java 11 performing following steps.
Changed to Java 8
Build the Project with the command ‘mvn clean install’
Changed to Java 11
Executed the command to analyze the Project.
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=XXXXX
What I am missing?
ganncamp
(G Ann Campbell)
February 28, 2023, 1:05pm
10
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
miq
(smc)
February 28, 2023, 3:03pm
11
Hi
I am executing the command locally on my machine, so how can it be on the Bitbucket Cloud side?.
ganncamp
(G Ann Campbell)
February 28, 2023, 5:09pm
12
Hi,
I was basing that off your OP:
smc:
Bitbucket Cloud
Ann
miq
(smc)
March 1, 2023, 6:30am
13
So any other suggestions?.
ganncamp
(G Ann Campbell)
March 1, 2023, 1:19pm
14
Hi,
I’m back to:
Because I can only go by the error message.
Ann
miq
(smc)
March 1, 2023, 3:38pm
15
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
ganncamp
(G Ann Campbell)
March 1, 2023, 3:39pm
16
Hi,
You’ve long since marked this thread solved and the question has evolved. You should create a new thread.
Thx,
Ann
system
(system)
Closed
March 8, 2023, 3:41pm
18
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.