Bitbucket Pipeline fails to run - Could not determine the dependencies of task ':sonarqube'


Fail to get pipeline to run but it is working locally on our laptops without an issue.

Repo : Bitbucket
CI : Bitbucket Pipeline
Language : Gradle + Kotlin

It spits out this error in Bitbucket pipline :-

And if I were to trace it to the source code

boolean unitTestTaskDepAdded = addTaskByName(p, "compile" + capitalize(variant.getName()) + "UnitTestJavaWithJavac", allCompileTasks);

We are returning something in variant but it looks like it’s not getting pickup in the pipeline.

Here is a snippet of our build.gradle

    plugins {
        id "jacoco"
        id "java"
        id "application"
        id "org.sonarqube" version "2.8"

    sonarqube {
        androidVariant 'deviceDebug'

        properties {

             * Enable Sonarcloud to run from gradle
             * */
            property "", ""
            property "sonar.login", "xx"
            property "sonar.organization", "xx"
            property "sonar.projectKey", "xx"


Here is a snippet of bitbucket-pipelines.yml

image: java:8

  depth: full              # SonarCloud scanner needs the full history to assign issues properly

    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
          - gradle
          - sonar
          - ./gradlew sonarqube --stacktrace
          - build/libs/**

    - step: *build-test-sonarcloud
      - step: *build-test-sonarcloud

Thank you and let me know where I got it wrong.

Could only post a single because I’m a new user.

Here is the end of the stack trace where it points out the null pointer exception.

Just a quick follow up on this. Thanks!

Hi @claytonnarcis,

Sorry for the silence here, we are currently investigating, thanks for your patience :slight_smile:

In the meantime, I’m not familiar at all with gradle but I noticed that you removed the build in your gradle script, as you can see in our example. Any reason why you removed it? It may worth a shot trying to add it back and try again.


Hi @aurelie, the Gradle script is much longer and only pasted sonarqube integration.

If it helps, I can prepare a sample project to replicate this problem and send it over to you. Let me know if it’s something you or your team will need.

Hi @claytonnarcis,

That would really help a lot! Can you post your example in a public GitHub repository or similar? Or I can open a private thread for us if needed, just let me know.

Hi @janos

Can we open a private thread for this? I’ve setup the repo already and able to reproduce the error.

Hi @claytonnarcis, thanks for providing the reproducer. Unfortunately I still don’t know what causes this behavior, and I cannot offer a workaround. I created a ticket to track this issue, but I don’t have a time frame for completion: SONARGRADL-67

Hi @janos, that’s a bummer.

Will follow that issues on Jira. Thank you for looking into this.