Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Sonarcloud analysis in pipelines (java 8 + java 11)

Our project uses Gradle + Java 8. At the moment it's not possible to migrate over to Java 11.

SonarCloud needs Java 11.

Does anyone know how to setup Bitbucket pipelines where Java 8 is used for building our project and Java 11 is used for SonarCloud analysis?

1 answer

0 votes

Hi Fred,

For every step you define in your bitbucket-pipelines.yml file, a Docker container starts, the repo is cloned in that container and then the commands of the script are executed.

If you don't define an image for the Docker container, then the default one (atlassian/default-image:2) will be used.
It is possible to define which Docker image you want to use either at the global level or at the step level (so each step can run on a different image).

What you can do is
- create a step for your build, and for this step use a Docker image that has Java 8
- create another step for SonarCloud analysis, and for this step use a Docker image that has Java 11

We support public and private Docker images including those hosted on Docker Hub, AWS, GCP, Azure and self-hosted registries accessible on the internet.

If you need in the SonarCloud analysis step any files that were generated during the build in the previous step, you can define them as artifacts so that these files will be available in the next step:

If you don't need that and the second step is not dependant on the first one, you can also run these two steps as parallel ones.

If you have any questions and/or need more information about my suggestions, please feel free to let me know.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

218 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you