I noticed that Gradle also includes re-packaged Guava under org.gradle.internal.impldep.com.google.common.base package but as stated by the exception from the linked issue, the original Guava classes are used by gradle-base-services module.
What is the policy for Guava dependency in Gradle distribution? Should the modules use the re-packaged version so the plugins can add their own version? If not, is there any isolation mechanism that could allow a plugin to use a different Guava version?
As you can see in the linked issue, when I don’t specify Guava dependency in my plugin, version 17 is added by Gradle to satisfy gradle-base-services module requirements and is loaded (in my example) from the following path:
and this path is part of the Gradle distribution. guava-jdk5-17.0.jar archive contains Guava classes in their original packages - they are not repackaged under internal Gradle package.
Guava is not part of Gradle’s API, so it will not be exposed to your plugin. We have filtering classloaders that make sure that your plugin cannot see it. Can you provide a reproducible example where you had this problem?
That’s a transitive dependency of the plugin-publish plugin and it’s in the buildscript.classpath. It’s expected that that would be visible until we have some isolation between external plugins.
But Piotrek was saying that he gets the Guava library from the Gradle distribution, which should never happen.
@Gary_Hale do we have some tests for worker executors not leaking Guava and other dependencies?