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,560,241
Community Members
 
Community Events
185
Community Groups

How to give .class files path in Dsonar.java.binaries from target folder

Edited

Hi All

Recently I am facing an issue while setting binary path in my sonar maven 3 task in bamboo pipeline.

I am using below 

-Dsonar.login=some login key -Dsonar.test.inclusions=src/main/java -Dsonar.java.binaries=gen/main/java

But when I pass the binary path as gen/main/java or target/classes system bamboo is unable to find that location or .class files.

So how to set .class files path in sonar.java.binaries to get it from generated target folder.

Or what exactly yhe path I need to provide.

Thanks

1 answer

0 votes
Lasse Langhorn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 30, 2020

Hi,

If you have defined your Sonar binaries as a Bamboo capability in Bamboo you can use this capability in your Maven 3.x task like so:

-Dsonar.login=some login key -Dsonar.test.inclusions=src/main/java -Dsonar.java.binaries=${bamboo.capability.<your-sonar-capability-label>}

Bamboo will translate your ${bamboo.capability.<your-sonar-capability-label>} variable to the path of the Sonar binaries eg. /pack/sonar-home/.

Hope this will help you.

Regards

Lasse Langhorn

Hi @Lasse Langhorn 

Thanks for your replay.

So I have set it like below

-Dsonar.login=loginkey -Dsonar.test.inclusions=src/main/java -Dsonar.java.binaries=${bamboo.capability.sonar.java.binaries}

but I getting below error

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project ui-test-framework: No files nor directories matching '${bamboo.capability.sonar.java.binaries}' -> [Help 1]

 

 

Lasse Langhorn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 30, 2020

Hi,

What is your Sonar capability key in Bamboo for the Sonar capability?

Go to Bamboo administration > Server capabilities -> Click on your Sonar capability and then look the capabilityKey parameter in the URL of the page: eg. capabilityKey=system.jdk.JDK+1.7.0.80

Then you can use the capabilityKey in the Maven task:

-Dsonar.login=loginkey -Dsonar.test.inclusions=src/main/java -Dsonar.java.binaries=${bamboo.capability.<sonar.capability.key>}

Is this capability key the same as "sonar.java.binaries"?

Regards

Lasse Langhorn

Hi @Lasse Langhorn 

Thanks for the quick response. But I don't have the admin permission.

Can we give the path like -Dsonar.java.binaries=${WORKSPACE}/**/target/classes

is that possible ?

Lasse Langhorn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 30, 2020

Hi,

Try this:

-Dsonar.java.binaries=${bamboo.build.working.directory}/target/classes

Regards

Lasse Langhorn

Hi @Lasse Langhorn 

I have tried that and looks like there are no .class files inside target.

Do you have any idea whre the class files will get generate ?

Thanks.

Tanmoy

@Lasse Langhorn thanks

It works -Dsonar.java.binaries=${bamboo.build.working.directory}/target/classes  but  before that I added a maven 3.x task to generate the target with goal clean compile.

Lasse Langhorn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2020

Hi @tanmoysahat

That is great. I assumed your project was had a Maven setup so that is why I gave you the path /target/classes.

Regards

Lasse Langhorn

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events