I had the same problem and solved it by properly adding the repository and the dependency as described in the link you provided:
repositories {
maven {
url “https://plugins.gradle.org/m2/”
}
}
dependencies {
classpath “org.sonarqube.gradle:gradle-sonarqube-plugin:1.0”
}
https://plugins.gradle.org/m2/ is not redirecting to bintray. you should
be able to find the plugin when searching for it via plugins.gradle.org
along with information how to apply it in your build.
we have the same problem. When i am using the code snippet from the sonar plugin site ( Gradle - Plugin: org.sonarqube ) , the gradle build fails with the following Stacktrace:
FAILURE: Build failed with an exception.
Where:
Script (Path to Script) line: 14
What went wrong:
A problem occurred evaluating script.
After some discussion with the developer we found out, that using the new plugin syntax is working, but the old syntax is not.
Does anybody has an idea, what could cause this strange behaviour?
UPDATE/SOLUTION: The old syntax is also working, but you cannot use the plugin id if you are using the plugin in an script that was included using apply from: 'yourScriptUsingThePlugin.gradle'
Instead you have to use the PluginClass like that:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies { classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0.1" }
}
// To apply a third-party plugin from an external build script,
// you have to use the plugin's fully qualified class name, rather than its ID
apply plugin: org.sonarqube.gradle.SonarQubePlugin
I hope this helps other users getting the same error message.
Thank you !! Indeed it helped.
In a single build.gradle, the plugin is resolved. In a script included with the ‘apply from:’ syntax, it’s not.
The strange thing is that the debug traces show that the plugin is found:
[org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 14: acquired lock on root.1.2.3
[org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Resolve sonarqube-gradle-plugin.jar (org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2)' started
[org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Resolve sonar-scanner-api.jar (org.sonarsource.scanner.api:sonar-scanner-api:2.9.0.887)' started
[org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for metadata-2.58/module-artifact, path C:\Users\gerald\.gradle\caches\modules-2\metadata-2.58\module-artifact.bin, access org.gradle.cache.internal.DefaultCacheAccess@295a0c89
[org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache module-artifact.bin (C:\Users\gerald\.gradle\caches\modules-2\metadata-2.58\module-artifact.bin)
[org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Found artifact 'sonarqube-gradle-plugin.jar (org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2)' in resolver cache: C:\Users\gerald\.gradle\caches\modules-2\files-2.1\org.sonarsource.scanner.gradle\sonarqube-gradle-plugin\2.6.2\c6e2da4c6dd1bccab1753ca1faa9b33688339fb6\sonarqube-gradle-plugin-2.6.2.jar
[org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Resolve sonarqube-gradle-plugin.jar (org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2)'
[org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Resolve sonarqube-gradle-plugin.jar (org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2)' completed
[org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.2.3 completed (1 worker(s) in use)
[org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Found artifact 'sonar-scanner-api.jar (org.sonarsource.scanner.api:sonar-scanner-api:2.9.0.887)' in resolver cache: C:\Users\gerald\.gradle\caches\modules-2\files-2.1\org.sonarsource.scanner.api\sonar-scanner-api\2.9.0.887\daf561ff8b9d3f83bbd2080c44083147426dc9ae\sonar-scanner-api-2.9.0.887.jar
[org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 14: released lock on root.1.2.3