Using groovy 4.0.26 in a Gradle plugin

Creating a child first classloader and dynamically fetch the dependencies and then call my library is quite a lot of work

And illegal.
A “child first” classloader violates the class loader contract.

I don’t think you can “get rid” of the Groovy in the classpath as that is part of the top-most class loader.
But you can get an ExecOperations instance injected to your plugin and then use javaExec on it to execute your code out-of-process, where you have full control over the classpath.

1 Like