Gradle 1.2: Exclude directory under resources sourceSets

Using Gradle 1.1, this works for me:

apply plugin: 'war'

sourceSets {
    main {
        resources {
            exclude '**/test/*'
            exclude 'certs/test'
        }
    }
}

I had a similar problem with production files in a JAR file (though mine were not test files). I solved it with the following:

jar {
    exclude ("DIRECTORY-TO-EXCLUDE/**")
}

e.g.

jar {
    exclude ("test/**")
}