Here's a snippet of a Gradle build script that filters web.xml both when building a WAR and when running the webapp with gretty's appRun task. Is there a way to share a single 'filesMatching' definition instead of repeating it?
import org.apache.tools.ant.filters.ReplaceTokens
def tokens = [
"foo": "bar",
]
war {
filesMatching("WEB-INF/web.xml") {
filter(ReplaceTokens, tokens: tokens)
}
}
gretty {
webappCopy {
filesMatching 'WEB-INF/web.xml', {
filter(ReplaceTokens, tokens: tokens)
}
}
}
According to the gretty documentation, any configuration added to webappCopy
will be automatically added to war
by the plugin.