Gradle resources 'from' doesn't work

(Yurii) #1

please, explain me why the next code doesn’t have any effect??

apply plugin: 'war'
apply plugin: 'java'


processResources {

(Mark Vieira) #2

Looks like because you are excluding all contents of that directory so nothing additional will be copied.

(Yurii) #3

Sorry, I was not clear enogth with explanation of my problem. I actually do want to exclude all contents from that directory but all files stay there in my war.

(Pierre) #4

You should use from if you need to extend the default conventions brought by the Java Plugin when processing resources. By default it will copy src/main/resources and if you do not want all the content of that directory, simply write:

processResources {
    // Do not copy src/main/resources/**/someNotEmptyDir
    exclude "**/someNotEmptyDir"

Use from to add another resource directory:

processResources {
    from ('src/main/config') {
        // Do not pick src/main/config/**/someNotEmptyDir
        exclude '**/someNotEmptyDir'