Now, let us see how we can put the resources features of Maven to good use, that is, to perform variable replacements on project resources. This feature is useful when you need to parameterize a build with different configuration values, depending on the deployment platform.
You can define variables in your resources. Let us see how we can get the value of these variables from properties, resource filter files, and the command line.
To perform filtering using resources, use the following steps:
Add a property with a variable in the
src/main/resource/app.properties
file:display.name=Hello ${project.name}
Add the following code in the pom file:
<build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build>
Invoke the
process-resources
phase:mvn process-resources
Examine the processed resource...