Create jar with multiple source folders and different includes

Hello,

converting our build from ant to gradle, I currently fail in creating a jar.
Say, we have folders source1 and source2, both contain xml, xsd and class files.
In the resulting jar the following files should be contained:

source1/**/*.xml
source1/**/*.xsd
source2/**/*.class

I tried the following:

    task createJar(type: Jar){
        from {
            files("source1")
            include "**/*.xml", "**/*xsd"
        }
        from {
            files("source2")
            include "**/*.class"
        }
        archiveName = "myJar.jar"
    }

and fail:
Circular dependency between the following tasks:
:createJar
— :createJar (*)

Can someone help me?

Thanks
Jan