Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
701 views
in Technique[技术] by (71.8m points)

Gradle 1.2: Exclude directory under resources sourceSets

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Using Gradle 1.1, this works for me:

apply plugin: 'war'

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...