I have a web application and I use gradle to build it. In one of the xml files in WEB-INF folder (src/main/webapp/WEB-INF/my.xml) I have a piece of file that needs replacing.
<system-properties>
<property name="clientId" value="@clientId@" />
</system-properties>
When I try to replace the token with some value using:
processResources{
filter(ReplaceTokens, tokens:['clientId': 'test'])
}
Than when I run gradle build
the token in the output file (./build/exploded-app/WEB-INF/my.xml)
is not replaced. I was wondering which is the correct way to do this?
The problem is that you are configuring the wrong task. processResources
only copies files from src/main/resources (or whatever else you define in the main sourceSet as resource), while it is task war
which copies / zips your my.xml
.
war {
filter(ReplaceTokens, tokens:['clientId': 'test'])
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With