Gradle 1.2:排除资源 sourceSets 下的目录 [英] Gradle 1.2: Exclude directory under resources sourceSets
问题描述
我有一个外部库所需的开发相关目录 src/main/resources/certs/test
.这有一些在生产版本中不需要的证书文件.
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.
目前我在 build.gradle
中使用以下块排除该目录下的所有内容:
At the moment I exclude everything under that directory with following block in build.gradle
:
sourceSets {
main {
resources {
exclude '**/test/*'
}
}
}
这做得很好,但留下丑陋的空目录 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?
我试过排除 '**/test'
,但它根本不起作用.
I've tried excluding '**/test'
, but it doesn't work at all.
我使用 war 插件和 Gradle 1.2
I use war plugin and Gradle 1.2
推荐答案
使用 Gradle 1.1,这对我有用:
Using Gradle 1.1, this works for me:
apply plugin: 'war'
sourceSets {
main {
resources {
exclude '**/test/*'
exclude 'certs/test'
}
}
}
这篇关于Gradle 1.2:排除资源 sourceSets 下的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!