Building a project with Groovy extension methods in it

Hi,

I’m trying to build a simple Groovy project which contains a package with a Groovy extension method.

When I try to compile the project the classes using the extension method can’t find it. The descriptor and the class are picked up correctly by the IDE.

I guess the problem is that the extension method is needed at compile time by which it probably hasn’t been compiled yet.
I’ve tried creating different sourceSets but with no success.

dependencies {
    compile 'org.codehaus.groovy:groovy:2.4.7'
    compile 'org.membrane-soa:service-proxy-core:4.2.2'
    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
    extensionCompile 'org.codehaus.groovy:groovy:2.4.7'
}

sourceSets {
    extension {
        groovy {
            include '**/ClosureExtension.groovy'
        }
    }
    main {
        groovy {
            compileClasspath += extension.output
        }
    }
}

The extension method lives in src/main/groovy/com/predic8/membrane/dsl/extension and the rest of the project in src/main/groovy/com/predic8/membrane/dsl/.

P.S.: The project classes are all annotated with @CompileStatic.