How to reproduce the issue
git clone https://github.com/sensui/gradle-onlyif-issue.git
gradlew mytask
The task that fails
task mytask(onlyIf: true) << {
println 'executing mytask'
}
Actual output
$ gradlew mytask
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\projects\others\gradle-onlyif-issue\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating root project 'gradle-onlyif-issue'.
> Could not create task 'mytask': Unknown argument(s) in task definition: [onlyIf]
* 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.879 secs
Expected output
$ gradlew mytask
:mytask
executing mytask
BUILD SUCCESSFUL
Total time: 1.737 secs
More details
$ gradlew --version
------------------------------------------------------------
Gradle 1.8-rc-2
------------------------------------------------------------
Build time:
2013-09-19 05:33:14 UTC
Build number: none
Revision:
4f5d61b493480a5541898257eb1e4eb280d38826
Groovy:
1.8.6
Ant:
Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:
2.2.0
JVM:
1.6.0_27 (Sun Microsystems Inc. 20.2-b06)
OS:
Windows 7 6.1 amd64
Important
The build passes when using gradle 1.7, but fails when using any of the 1.8 release candidates.