I converted a Java project from Maven to Gradle, and now my JUnit 4 tests don't work. The tests rely on hooks that get added to core JUnit 4 classes by a Java agent. Everything worked as expected in the Maven version of the project. However, it appears that Gradle is loading the core JUnit 4 classes into the class cache before my agent runs, so my hooks never get installed in the converted project.
Does anyone know of a way to get Gradle to run my JUnit 4 tests in a separate thread or process with its own class cache?