On 03/10/2011, at 12:38 PM, Runar Myklebust wrote:
> Hi.
>
> I have created a custom plugin, with a number of defined tasks. The plugin is
> packed as a jar, and I apply it to the build.gradle file from where I'd like
> to use the tasks:
>
> apply plugin: 'ert'
>
> buildscript {
> repositories {
> mavenCentral()
> flatDir(dirs: file('libs'))
> }
>
> dependencies {
> classpath 'com.enonic.ert:ert-gradle-plugin:1.0'
> }
> }
>
>
> Then, I define the tasks:
>
> task syncLocalhost(type: ERTSync) {
> source = "local"
> target = "localhost"
> }
>
> But this will fail with the exception:
>
> Cause: Could not find property 'ERTSync' on root project 'testDist'.
>
> I have to to the explicit import of the groovy tasks in the plugin, e.g:
>
> import com.enonic.ert.tasks.*
>
> Then everything works as expected, but I guess this should not be neccessary
> - so how shall I avoid this?
There's currently not any smarts about trying to import classes from other
namespaces.
Here is what Gradle imports implicitly:
https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/resources/org/gradle/configuration/default-imports.txt
I agree that it would nice to not have to import plugin classes, but I'm not
aware of any mapped out strategy for solving this.
The best thing to do at this point would be to raise an enhancement request:
http://issues.gradle.org
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email