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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,618
Community Members
 
Community Events
184
Community Groups

SONAR Cloud Integration

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

 ${home}/.m2/

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:
script:
- 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

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

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

<configuration>
<jdkHome>/opt/atlassian/pipelines/agent/build/.jdk/jdk11</jdkHome>
</configuration>

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? 

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
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events