A property is used to supplied value of resource files at build time. This process is called filtering.
A property can be:
Filtering is dsiable by default. To enable it, you must modify the filtering element of the Pom.xml.
<project>
.......
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
<project>
....
<properties>
<my.filter.value>hello</my.filter.value>
</properties>
</project>
In src/main/filters/
Example: filter.properties:
# filter.properties
my.filter.value=hello!
The external property file must be defined in the POM.xml
<build>
<filters>
<filter>src/main/filters/filter.properties</filter>
</filters>
.......
</build>
To reference a property from the configuration files, the property name uses the following syntax:
${AliasRootElement.element}
where:
Some elements have default values and then don't need to be explicitly defined.
Example:
Filtering resources can also get values from system properties built into Java like:
Properties can also be defined on the command line using the standard Java -D parameter.
Example: To define the property command.line.prop with the value “hello again”
mvn process-resources "-Dcommand.line.prop=hello again"
Process / Thread - Environment Variable
${env.variable_name}
https://books.sonatype.com/mvnref-book/reference/resource-filtering-sect-properties.html
The property values will be supplied when the resource is filtered.
Example: application.properties in the src/main/resources directory
# application.properties
application.name=${pom.name}
application.version=${pom.version}
java.version=${java.version}
command.line.prop=${command.line.prop}
mvn process-resources