I have configuration.properties in configs/Configuration.properties where I have url path = http://finacial/dev3/api http:// financial/{env}/api I want to load the environment value from the pom.xml to replace dev 3 according to the environment property set in pom.xml.
You could use the filter option of the maven resources plugin , it does exactly that.
Variables can be included in your resources. These variables, denoted by the ${...} delimiters, can come from the system properties, your project properties, from your filter resources and from the command line.
Eg if you have a property url
in your pom
<properties>
<url>abc</ulr>
</properties>
and your.properties file contains a value ${url}
and you include the file in the resource section of the pom, then ${url}
will be replaced in the output file in the build target location by abc
upon issuing mvn resources:resources
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.