Sonarqube plugin debugging null pointer exception

To make this more exciting - I’m hitting a null pointer exception in the sonar plugin.

Caused by: java.lang.NullPointerException
        at org.sonar.java.checks.synchronization.SynchronizationOnGetClassCheck.isEnclosingClassFinal(SynchronizationOnGetClassCheck.java:68)

Before I submit a JIRA with more of the gory details, maybe even with a fix, I just can’t get my rebuilt plugin to get used from my mavenLocal. The build was successfully fetching 2.7.1 version, but when I try to shift to my 2.8-SNAPSHOT build in mavenLocal(), it keeps trying to fetch it from org.sonarqube:org.sonarqube.gradle.plugin:2.8-SNAPSHOT instead of the correct classpath which should be org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8-SNAPSHOT.

We don’t need to set the classpath for fetching 2.7.1 (or 2.6.2 for that matter). But to use mavenLocal, it complains.

- Plugin Repositories (could not resolve plugin artifact 'org.sonarqube:org.sonarqube.gradle.plugin:2.8-SNAPSHOT')

And the logs do say it is trying my maven local directory in ~/.m2/repository.

I’ve added the classpath like my other dependencies in the build.gradle. But it doesn’t fetch them from the repos listed there. I had to add mavenLocal() to settings.gradle and pluginManagement, which doesn’t have dependencies. It seemed I had to set the classpath with something special there, but that didn’t work either…

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == 'org.sonarqube') {
                useModule('org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8-SNAPSHOT')
            }
        }
    }
    repositories {
        mavenLocal()
        maven { url myNexusRepo }
    }
}

Same error. Any ideas how to get my gradle build to pick up my plugin from mavenLocal?

I figured this one out. The sonar-gradle-plugin has a build somewhere (which I couldn’t find inside the githut repo for it) that packages the plugin into org.sonar:org.sonarqube.gradle.plugin. I just copied the maven pom file from public maven repositories for the plugin, ran a mvn install, and my gradle fetched my 2.8-SNAPSHOT build.