Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Document a warning against static state in Gradle plugins #6818
Gradle attempts to reuse classloaders between build invocations to keep classes "hot" (since Gradle 2.4). This has implications for how Gradle plugins (and their dependencies) are written. Specifically, Gradle plugins, tasks, extensions, etc should in general not keep static state because it can cause problems like resource leaks and make it seem like configuration changes are being ignored.
This leads to other bad advice like:
This would be appropriate in our Gradle guides on plugin development and/or the user manual.
Given a plugin like this:
When you run
I've seen this a lot with people also expecting environment variable changes to take effect through some tasks that eventually
I know something got changed in 4.10 to fix this, but if there is a similar recommendation for that, it would also be useful.