I want to use a variable which has different values in the properties file depending on the environment. I want to use that variable in my pom.xml.
Add a set of appropriate
entries in your pom and include the variables you need in a list of
:
Dev
dev.proxy.host
1234
QA
QA.PROXY.NET
8888
Prod
true
PROD.PROXY.NET
8080
Notice that the Prod
profile has been tagged:
.
Within the properties file, use pom-style variable demarcation to add variable value placeholders, matching the
tag names used in the pom:
proxyServer=${proxyServer}
proxyPort=${proxyPort}
Within the pom's
section, add a
entry (assuming that your properties are in the src/main/resources directory), include a
tag, and set the value to: true
:
src/main/resources
true
settings.properties
Then, when you run your Maven build, the demarcated property values will be replaced with the values that are defined in the pom
entries.