On 28/11/2010, at 10:21 AM, Etienne Studer wrote:

> Hi
> 
> I tried to define a task type DirSizeCheck in an external script and include 
> it in my main script:
> 
> apply from: 'other.gradle'
> 
> Gradle finds the script but, unfortunately, it does not recognize my task 
> type and errors out in my main script with:
> 
> A problem occurred evaluating root project 'demo'.
> Cause: Could not find property 'DirSizeCheck' on root project 'demo'.
> 
> This should work, shouldn't it?

No, it doesn't yet. A script cannot contribute classes to the classpath of 
other scripts.

This is something we want to address. We plan to rework the classloading after 
the 0.9.1 release is out - mainly so that Baruch's maven plugins work out of 
the box, but also to fix up issues like this. The goal is to end up with very 
few differences in the capabilities of plugins written as scripts and plugins 
implemented as a jar.

In the meantime, you can workaround this by doing something like this in your 
external script:

project.DirSizeCheck = DirSizeCheck.class


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to