Sonar build runs locally but fails in BitBucket pipeline

  • ALM: Bitbucket Cloud
  • CI: Bitbucket Cloud
  • Scanner command: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
  • Languages: Java

When running the command locally the script runs and is completed. Results are shown in SonarCloud.

But When I’m running the command through the pipeline it fails. I added the pipeline log for more information. I’ve got a hard time pinpointing why it is failing.

Any help will be appreciated.

pipelineLog-{da8e25f7-c1c4-489a-a55b-da85adf61930}.txt (91.7 KB)

Hey there.

Your build seems to fail long before SonarCloud analysis:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project filemanager-domain: Fatal error compiling: invalid target release: 11 → [Help 1]

I would remove the org.sonarsource.scanner.maven:sonar-maven-plugin:sonar and work on having a working build in Bitbucket Pipelines, and then add SonarCloud analysis back in.

(Most likely, you need to make sure you’re using an image like image: maven:3.6.3-jdk-11 rather than a different JDK version)

Well, you were right. I hadn’t added the maven JDK in the pipeline.

Thank you very much.

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