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

Sonar Gradle task fails with error "SONAR4BAMBOO: was not able to find a SonarQube result URL"


I have just installed the Sonar for Bamboo plugin, and have trouble getting it to work.

I have followed the steps on to the best of my abilities, but when I try to run the build, the Sonar Gradle task fails with the following, not very descriptive reply:

15-May-2020 11:05:02 Starting task 'SonarQube' of type 'ch.mibex.bamboo.sonar4bamboo:sonar4bamboo.gradletask'
15-May-2020 11:05:02 SONAR4BAMBOO: No branch target found, will not configure
15-May-2020 11:05:02
Beginning to execute external process for build 'Project - Module - Build and Unit tests #71 (PRO-MOD-JOB1-71)'
... running command line:
./gradlew sonarqube --info -Dsonar.login=****** -Dsonar.password=****** ... in: /var/atlassian/application-data/bamboo/xml-data/build-dir/PRO-MOD-JOB1
... using extra environment variables:

[Long list of environment variables]

15-May-2020 11:05:02 Failing task since return code of [./gradlew sonarqube --info -Dsonar.login=****** -Dsonar.password=****** was -1 while expected 0
15-May-2020 11:05:02 SONAR4BAMBOO: was not able to find a SonarQube result URL
15-May-2020 11:05:02 Finished task 'SonarQube' with result: Failed

My environment setup is that I have Bamboo and SonarQube running on the same server on different ports. SonarQube is running in a Docker Container that is accessible via port 9000, and I can successfully log in to its web interface, so I can say for sure that it's accessible.

However, I have no idea why the Sonar Gradle build step fails, primarily because apart from the above lines no error is generated, so I don't have any idea what could be wrong here.

Any advice on this would be greatly appreciated.

2 answers

1 accepted

0 votes
Answer accepted

I figured out what was missing. All the other build steps had a working subdirectory set, and once I set that to the same value for the Sonar Gradle step, it worked fine.

By the way, is there a way to globally set the working subdirectory for the entire build? This has happened so many times now with different steps, it's actually embarrassing that it wasn't the first thing I tried. =<,<=

Hi Kira,

Could you tell what did you write in working subdirectory  because i'm also getting this:

SONAR4BAMBOO: was not able to find a SonarQube result URL
Finished task 'SonarQube' with result: Failed

Well, that will probably not help you much, since it is just one word.

So I'll try to elaborate: We have a project structure that looks like this:


The build for module-a has "module-a" written in the "working subdirectory" field of all its build steps, the build for module-b has "module-b" written in all of them, etc...

It's literally just "module-a", without any /, \, . or whatever


The app fails when it tries to parse the build log for the result URL to be able to show a link to the SonarQube analysis results on the Bamboo build page. Do you see a message like

17:01:02.199 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/MY-GRADLE-JOB1

in your build log? That is what the app is looking for, and otherwise it will fail with the above message. This could be due to the SonarQube analysis not being successful which I cannot see in your log excerpt.


Michael (app vendor)

Nope, the error was actually that the working subdirectory was not set correctly. It took me a while to figure this out, though, since the Sonar Gradle task did not display any indication of this in its log. The above messages were literally all the messages that Sonar Gradle gave me, so I just did not know what went wrong.

Suggest an answer

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

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

50 views 0 3
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