Well the file path I want to exclude from WEB-INF/classes is:
src/main/resources/dev.properties
It’s not really that a particular expression is working unexpectedly – I’ve tried a few things that don’t seem to work, but in most I cases I think I understand why. So now I just can’t find one that does what I want and trial and error is getting tiresome.
//try 4: doesn't exclude the file and has weird effect of duplicating all jars in WEB-INF/lib...
classpath = classpath - files('resources/dev.properties')
‘exclude “WEB-INF/classes/dev.properties”’ doesn’t work? (You should first make sure that the path is correct by looking into the War, e.g. with ‘jar -tf path/to/war’).
No that doesn’t work. Correct me if I’m wrong, but it’s not building the war file from there is it? It uses the stuff inside of ‘build/’ such as ‘build/resources/main/dev.properties’.
But I don’t know how to exclude that. If you see my previous post I tried 'exclude ‘…/resources/dev.properties’.
And just to be clear this is in the context of the war configuration such as:
war {
dependsOn x, y, z
manifest {
...
}
archiveName = 'MyApp.war'
//TODO: fill in the blank how to exclude src/main/resources/dev.properties
}
Sorry you are right. You’ll have to exclude based on, and relative to, the source path. However, for some reason the ‘War’ task shields ‘WEB-INF’ content from direct modification. Eventually I came up with this solution: