Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle 1.2: Exclude directory under resources sourceSets

Tags:

gradle

I have development related directory src/main/resources/certs/test which is needed for one external library. This has some cert files which are not needed in production build.

At the moment I exclude everything under that directory with following block in build.gradle:

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

This does it job well, but leaves ugly empty directory test lying there. What are my options to not include this directory in final war?

I've tried excluding '**/test', but it doesn't work at all.

I use war plugin and Gradle 1.2

like image 848
ilvez Avatar asked Sep 27 '12 09:09

ilvez


1 Answers

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/**")
}
like image 200
toddcscar Avatar answered Sep 19 '22 14:09

toddcscar