I am using maven with the jacoco plugin to generate code coverage metrics. I am having some difficulty in configuring the surefire plugin with the java opt
I recently ran into the same issue and even took implicitly the same steps as you described with the same result. No clean solution I found worked for me.
So I ran several steps in debug mode and it seems that Maven replaces properties twice. That is not just in a lazy manner, as I thought, but in both eager and lazy manner:
eagerly (before any goal is run) are replaced static properties (defined in properties section of POM and probably also settings.xml),
lazily (before each execution) are replaced dynamic properties.
This is where our step with setting a blank property as a default failed. Maven just went:
eager replace of default value (blank)
JaCoCo sets dynamic value
lazy replace of dynamic values (nothing to replace now, already used the blank value)
Finally the solution is to set the default value dynamically. This can be done with GMaven plugin like this: