[GRADLE-3220] Out of process compilation does not isolate classpath from Gradle infrastructure Created: 04/Jan/15  Updated: 27/Jan/17  Resolved: 11/May/15

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.4-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 2


Linked forum post highlighted this.

The problem appears to be our use of the default classloader creation strategy for the annotation processing classpath. When joint compiling, we run the Java compiler in process. When we create the compiler, we use the StandardFileManager which creates a classloader to load the annotation processing classpath based on the class that loaded com.sun.tools.javac.file.JavacFileManager (see getClassLoader(URL[])) of this class), which seems to have visibility to Gradle internals in this mode.

It's also possible that this affects more than annotation processing, and isn't limited to in process compile.

Comment by Daz DeBoer [ 11/Jan/15 ]

From Will Erickson:

I've been able to confirm that I can reproduce the problem with java compilations if I enable forking.

However, based on what you've said, I've also been able to confirm that I can work around this problem in groovy builds if I disable forking, by doing the following:

compileGroovy {
groovyOptions.fork = false

Generated at Wed Jun 30 12:43:06 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.