How to set default values for missing environment variables in maven pom -
is possible have maven provide default values missing environment variables? if so, how?
context:
i have properties files placeholders environment variables, this: my.property=${env:environment_property}
running maven (edit: not mvn ... -denvironment_property=some_value
) if environment variable set in os makes resolve property placeholder given value. if environment variable not exist, value blank.
problem:
i environment variables have default value. if environment variable not exist should given default value specified in pom or properties file or whatever.
important:
the property placeholders have point environment variable.
the maven resources plugin friend. should run part of build. not filter resources default. have configure that:
<resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource>
then configure filter:
<build> ... <filters> <filter>my-filter-values.properties</filter> </filters>
put default values want file. given precedence of properties in maven:
(1) command line (2) settings.xml (3) pom.xml (4) filters
the properties in filter file can act want have defaults.
for proper explanation of filters, consult official documentation: filters under maven-resources-plugin ! (it's here)
Comments
Post a Comment