kordamp / kordamp-gradle-plugins

A collection of Gradle plugins
https://kordamp.org/kordamp-gradle-plugins/
Apache License 2.0
138 stars 25 forks source link

[Sonar] Organisation required even the host URL is set #456

Closed musketyr closed 3 years ago

musketyr commented 3 years ago

There is currently no easy way how to set hostUrl from the config as when it is set then you have a validation error of missing organization. The host URL must be set using sonar.host.url instead even for invocations which does not include the sonarqube task.

The following setup does not work:

config {
    quality {
        sonar {
            hostUrl = 'https://sonar-developer.beta.agorapulse.com'
            // no organization set here
            // other config
        }
    }
}
aalmiray commented 3 years ago

Ah. So hostUrl should be decoupled from organization and validation should be skipped/made optional?

musketyr commented 3 years ago

well, the core problem is that even if hostUrl is set to a different value, this condition is still true I guess it's some weird Gradle voodoo going on.

https://github.com/kordamp/kordamp-gradle-plugins/blob/master/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/plugin/base/plugins/Sonar.groovy#L116

aalmiray commented 3 years ago

Huh, that's odd. So hostUrl must be setup but allows for an external value to be provided by sonar.host.url. I remember that change. However the condition , having it evaluate no matter the value of the hostUrl property, ... perhaps if the value were to be checked against a local variable, to avoid "static Groovy voodoo" (Gralde 6 relying on Groovy 2.5.x is unnerving to say the least ...)