In certain scenarios, Gradle 1.9-rc-2 is throwing exceptions when overwriting tasks. It appears it occurs if you overwrite a task that has already been overwritten:
repositories {
// Use 'maven central' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// We use the latest groovy 2.x version for building this library
//compile 'org.codehaus.groovy:groovy:2.1.7'
// We use the awesome Spock testing and specification framework
//testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
//testCompile 'junit:junit:4.11'
}
apply plugin: 'groovy'
task clean(type: Delete, overwrite: true) {
delete buildDir
}
task clean(type: Delete, overwrite: true) {
delete buildDir
}
Results in this message:
$ gradle tasks
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/jengelman/workspace/personal/overwrite-test/build.gradle' line: 34
* What went wrong:
A problem occurred evaluating root project 'overwrite-test'.
> Tried to remove model tasks.clean but it is not registered
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.718 secs
Running this same command in Gradle 1.8 results in a successful build.