Sonarcloud integration with AWS codebuild

I am trying to setup code build for one of the projects for Sonarcloud, everytime I run the build, I am getting this error - be it a PHP project or a Java project, any help on what to include in the YML file
ERROR: Error during SonarQube Scanner execution
994 ERROR: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Hi @apsb007 welcome to the community.

Which image identifier are you using in your buildspec ?

1 Like

Hi @mickaelcaro I am using Ubuntu - standard 5.0 (Only 4.0 and 5.0 is available right now in codeBuild) -aws/codebuild/standard:5.0
Any help will be appreciated as I am stuck right now

Thanks.

Can you double check what is the value of JAVA_HOME just before running the scanner itself ?

Seems that coretto11 is installed and filling this env by default, but we never know.

Hi @mickaelcaro you are right, the Java version is coretto11, here is the output
/usr/lib/jvm/java-11-amazon-corretto
986

I did specifically set the runtime Java version as Coretto8, but still getting the same error

No JDK should be in java 11 to be able to run any analysis now, but i guess that at some point Java8 is still taken at the moment of the analysis.

Which scanner are you running ? Can you show up a bit more of your configuration maybe ? A snippet of how you pipeline looks like may help.

Thanks.