Gradle 1.2:排除资源sourceSets下的目录 [英] Gradle 1.2: Exclude directory under resources sourceSets

查看:1829
本文介绍了Gradle 1.2:排除资源sourceSets下的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个外部库需要的开发相关目录 src / main / resources / certs / test 。这有一些在生产版本中不需要的证书文件。



目前,我将该目录下的所有内容都排除在 build.gradle

  sourceSets {
main {
资源{
排除'** / test / *'
}
}
}

这样做效果不错,但在那里留下丑陋的空目录 test 。我的选择不包括这个目录在最后的战争?



我试过排除'** / test',但它根本不起作用。



我使用war插件和Gradle 1.2

解决方案

使用Gradle 1.1,这对我很有用:

  apply plugin:'war'

sourceSets {
main {
资源{
排除'** / test / *'
排除'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.

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

解决方案

Using Gradle 1.1, this works for me:

apply plugin: 'war'

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

这篇关于Gradle 1.2:排除资源sourceSets下的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆