When applying my own custom plugin which in turn applies groovy (plugin), it fails with Failed to apply plugin [id 'groovy']
which is caused by java.lang.IllegalStateException: model 'tasks' is finalized
thrown from org.gradle.model.internal.registry.DefaultModelRegistry.assertNotFinalized
Is it somehow impossible to apply groovy
from another plugin? Or what am I missing here?
The project where my plugin is applied:
buildscript {
repositories {
mavenCentral()
maven {
url file( '../../maven-deploy' )
}
}
dependencies {
// will be loaded from maven-deploy, not mavenCentral().
classpath 'se.toxbee.robospock:gradle-plugin-robospock:0.1.0'
}
}
apply plugin: 'robospock'
And the code where groovy is applied:
def applyGroovy( RoboSpockConfiguration cfg ) {
def p = cfg.project
if ( !p.plugins.hasPlugin( 'groovy' ) ) {
p.apply plugin: 'groovy'
}
}
The stacktrace: http://pastebin.com/ikXJTM67
The git repo: https://github.com/Centril/gradle-plugin-robospock (the README.md here is not accurate, don't read it...)
The application of groovy happens in an afterEvaluate closure, is this relevant perhaps?
If I add p.apply plugin: 'eclipse'
before the failing line, it doesn't fail due to eclipse, so applying plugins in general is not prohibited.