How can I override maven property values set by properties-maven-plugin's read-project-properties goal?


Staff member
In one of our projects, we use the properties-maven-plugin's read-project-properties goal to read property values from a file which are then used for filtering resources. See <a href="">this post</a> for a discussion on the general purpose of this procedure.

We would like to override some of the values found in the file using a suitable profile defined in the developer specific settings.xml (the same way we override properties set in the POM).

This, however, does not work for the properties set by the properties-maven-plugin.

How can we achieve our goal?

As a work around, we are currently registering an additional, developer specific file with the properties-maven-plugin to achieve this effect but it would be much more convenient to use the regular way (profiles).

In more general terms, the question is: How do properties set by properties-maven-plugin's read-project-properties goal tie into the property definition precedence hierarchy of maven, which is described in this <a href="" rel="nofollow noreferrer">very helpful blog post</a>.

I extracted the relevant elements of our POM into a toy project that demonstrates my issue. Here is the POM of the toy project:

&lt;project xmlns="" xmlns:xsi=""
  &lt;name&gt;Maven Test&lt;/name&gt;
  &lt;description&gt;A maven project to test filtering and the maven-properties-plugin&lt;/description&gt;
          &lt;!-- Read properties from a file --&gt;
          &lt;!-- The following execution is for debug purposes only --&gt;