Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

SONAR Cloud Integration

Parakh Maheshwari May 22, 2023

While trying to integrate SonarCloud and Bitbucket, the pipeline is failing because of non existing toolchains.

Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.


Is there a way to add toolchains via pipelines and cache it as well.

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2023

Hello @Parakh Maheshwari and welcome to the Community!

The error you reported seems to actually be a Maven-related error (see Maven - Guide on using Toolchain ). When defining the usage of the maven-toolchains-plugin in your pom.xml file, maven will by default look for the toolchains.xml file under the folder


If the file toolchains.xml is not that path, maven will fail with the error message you reported.

Since pipelines clone your repository files into the build container during the start of your build, one option would be for you to push the  toolchains.xml to a folder in your repository, so this file will be cloned along with the repository during the build start. Then during the build time, you can move/copy the toolchains.xml to the ${home}/.m2/ folder

For example, if you have pushed the  toolchains.xml file to the root of your repository, you would need to add the following command in your pipeline's script to copy this file to directory ${home}/.m2/ : 

- step:
- mkdir -p ${home}/.m2 && cp toolchains.xml ${home}/.m2/
- <rest of your commands>

 This would create the folder ${home}/.m2 and copy the toolchains.xml (that was added to the root of your repository) into that folder.

Hope that helps! Let me know in case you have any questions.

Thank you, @Parakh Maheshwari !

Patrik S

Parakh Maheshwari May 24, 2023

@Patrik S : Thank you so much for the steps. 

I still have one question, what should we define as jdk path in toolchains?


Is throwing me "Non-existing JDK home configuration at /opt/atlassian/pipelines/agent/build/.jdk/jdk11"

An update to toolchains is required or is there a path with respect to bitbucket that we can define for the pipeline to work ?

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2023

Hello @Parakh Maheshwari ,

This very much depends on the docker image you are using on your build step, as it might have the JDK installed in a different path.

Could you share what is the image you are using in your pipeline and what is the JDK version you would like to point to in your toolchains.xml file? 

Parakh Maheshwari May 25, 2023

Thanks @Patrik S  We were able to proceed with the suggestion provided.

Thanks a ton for taking this up.

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events