How can I change a .properties file in maven depending on my profile? Depending on whether the application is built to run on a workstation or the datacenter parts of the file my_config.properties change (but not all).
Currently I manually change the .properties file within the .war file after hudson builds each version.
As often, there are several ways to implement this kind of things. But most of them are variations around the same features: profiles and filtering. I’ll show the most simple approach.
First, enable filtering of resources:
Then, declare a place holder in your
src/main/resources/my_config.properties, for example:Finally, declare properties and their values in a profile:
And run maven with a given profile:
As I said, there are variation around this approach (e.g. you can place values to filter in files), but this will get you started.
References
More resources