gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

Build fails due to the incompatibility of the class path for Guava while using Docker and Spotbug together

Open pouryas7 opened this issue 5 years ago • 1 comments

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?

pouryas7 avatar Aug 26 '19 17:08 pouryas7

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.

mum-viadee avatar Sep 21 '19 18:09 mum-viadee