[digression: I send this question to mailing list 2 days ago but I believe new senders are moderated so I’d like to take this chance to play with forum :)]
With regard to this thread http://gradle.1045684.n5.nabble.com/processResources-filter-corrupts-binary-files-in-certain-environments-td4713752.html and this bug http://issues.gradle.org/browse/GRADLE-1566 :
I wanted to make the workaround proposed working for “war” too, so I tried something like that:
apply plugin: 'jetty'
war {
from(webAppDirName) {
exclude '**/*.html'
}
from(webAppDirName) {
include '**/*.html'
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [ …]
]
)
}
}
The configuration works but “from” above only adds, not replaces war’s source dir and I have all files in war duplicated. “Source” property on war is read only.
Finally the following configuration worked for me:
war {
eachFile {
if (it.name == 'my.html') {
it.filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: […])
}
}
}
But I’m curious if it’s possible to do this using “froms”?
I also tried something like this:
war {
exclude '**/*'
from(webAppDirName) {
exclude '**/*.html'
}
from(webAppDirName) {
include '**/*.html'
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [ …]
]
)
}
}
because I thought this will exclude everything for default “from” but not from my “froms” since they have their own exclude/include configuration. However, it turns out that now all files are excluded and no files end up in war.
This looks a bit inconsistent for me, because “from” adds sources not overrides, but exclude not only changes existing stuff but also the one I added with their own exclude spec.
Could you offer some thoughts on how the stuff works here?