In one of my plugins I have to create my own ClassLoader to make sure I do not include the runtime libraries that Gradle already provides (to avoid library version conflicts). The plugin is written in Groovy so I do want to include the provided Groovy library to be able to actually run the plugin code. To get the available library I use the following code:
ClassPathRegistry classPathRegistry = new DefaultClassPathRegistry() URL runtimeClasspath = classPathRegistry.getClassPathUrls('GRADLE_RUNTIME')
This works fine in milestone 3 but not in milestone 5. I haven’t had a look at the Gradle code yet but I guess the variable GRADLE_RUNTIME is not available anymore. This is the error I get:
Cause: unknown classpath 'GRADLE_RUNTIME' requested.
I could work around this by requiring users to include a Groovy library in the classpath but this feels kind of clunky. In general I think this question is part of a bigger discussion around the fact that Gradle should provide its own ClassLoader for plugins out-of-the-box which should be addressed at some point of time. For now I’d be interested what the recommended way is to get a reference to Gradle’s runtime classpath (optimally compatible in any milestone version of 1.0).