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:
Ideally, the init script would offer something like an allprojects { }
method, to make this kind of thing simpler.
> 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.
No comments:
Post a Comment