gradle-docker
gradle-docker copied to clipboard
Build fails due to the incompatibility of the class path for Guava while using Docker and Spotbug together
I added docker plugin to my project (I've already have Spotbugs plugin). After that the build fails with the following error:
* What went wrong:
Execution failed for task ':spotbugsMain'.
> Failed to run Gradle SpotBugs Worker
> Could not create an instance of type com.github.spotbugs.internal.spotbugs.SpotBugsExecutor.
> com.google.common.collect.ImmutableList.builderWithExpectedSize(I)Lcom/google/common/collect/ImmutableList$Builder;
This issue is as same as this one: https://github.com/spotbugs/spotbugs-gradle-plugin/issues/120
Here, it is suggested that I should add Guava dependency to my project. I did that. I still face the same issue after.
plugins {
...
id "com.palantir.docker" version "0.22.1"
id "com.github.spotbugs" version "2.0.0"
...
}
repositories {
mavenCentral()
}
dependencies {
...
compile 'com.google.guava:guava:28.0-jre'
....
}
Any idea?
I just had the same problem. You must add guava as dependency in the buildscript to force the version for the plugins.
Just add
buildscript { dependencies { classpath 'com.google.guava:guava:23.1-jre' } }
in front of the plugin block.