Error (sometimes) running custom tasks in gradle 1.9 when not cleaning before build

I have a project that has some custom task types in my buildSrc folder. In my build.gradle, I configure the task:

task myTask(type: com.something.MyTask) {
// my config here
}

I’m finding that I frequently get the error:

Could not find property ‘com’ on root proect ‘myproject’

It seems to happen often when I make a change the build file and then do a gradle build without doing a clean first.

I’ve only been noticing this in gradle 1.9, and I can’t figure out exactly how to reproduce it reliably, but hopefully these symptoms will be enough to help figure out what is going on.

Thanks for the report. We’d need more information to track this down, such as the output of ‘gradle -v’ and (ideally) instructions to reproduce.

I’m still trying to recreate it in an isolated environment, but I can reliably create this issue within my full project. Within my project, if I run ‘gradle build’, then modify the build file and run ‘gradle build’ again (without a ‘clean’), then I frequently see this error. But here’s what I have so far…

The output of ‘gradle -i --stacktrace’ is posted to https://gist.github.com/jeffastorey/8022521

The build.gradle line 168 where the error shows up is

task myCustomTask(type: com.myproject.MyTask) {

‘gradle -v’ outputs

------------------------------------------------------------ Gradle 1.9 ------------------------------------------------------------

Build time:

2013-11-19 08:20:02 UTC Build number: none Revision:

7970ec3503b4f5767ee1c1c69f8b4186c4763e3d

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.7.0_21 (Oracle Corporation 23.21-b01) OS:

Linux 3.5.0-44-generic amd64