I haven't personally used it, but the Worker API offers various levels of isolation for tasks, including class loader and process isolation modes.
https://docs.gradle.org/current/userguide/worker_api.html#ch...
https://docs.gradle.org/current/userguide/worker_api.html#ch...
One of the skeletons I wish they would fix - i was hoping this would happen in 7.0 - is isolated classloaders for plugins, or something like that.
At the moment, all the plugins can see any other plugins dependencies, like guava. Bringing in your own version of guava can break other plugins.
Maybe this has changed, but I don't think so.