Hi adam,
thank you for the snippet. Maybe it's a bit awkward but it works and
does the trick. To share this, I add this snippet to the gradle cookbook.
regards,
René
Am 07.07.10 23:22, schrieb Adam Murdoch:
On 7/07/10 7:06 AM, Rene Groeschke wrote:
hi there,
I would like to apply the eclipse plugin on demand via init script
while updating my eclipse classpath.
Is there a way to get this working and avoid the UnsupportedOperation
exception I got while trying " apply plugin'eclipse' " ?
Init scripts delegate to a Gradle instance, rather than a Project
instance as the build scripts do. And so, when you do apply plugin:
'eclipse', you're trying to apply a plugin designed to work with a
Project instance, to a Gradle instance. Of course, the error message
should tell you this (and what to do about it, too, I guess).
At the moment, it's a bit awkward to apply a project plugin from an
init script. You could do something like:
addListener(new ApplyPluginListener())
class ApplyPluginListener extends BuildAdapter {
public void projectsEvaluated(Gradle gradle) {
gradle.rootProject.allprojects { apply plugin: 'eclipse' }
}
}
Ideally, the init script would offer something like an allprojects { }
method, to make this kind of thing simpler.
--
------------------------------------
Rene Groeschke
[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email