4

I have a property which is designed like -dVerbose in mvn dependency:tree plugin. It does not require any value. If it is specified then some additional work is done in my application's tests.

So in Maven failsafe plugin i would like to either set some value (does not matter which one, but not null) or set it to null depending on which Maven profile is active.

I tried something like this:

<systemPropertyVariables>
    <doNotInsertData>${null}</doNotInsertData>
</systemPropertyVariables>

or <doNotInsertData>null</doNotInsertData> or <doNotInsertData/>.

But unfortunately all of above leads to not null property value when i run maven goal. Is it possible at all to pass null-value with pom.xml?

Kirill
  • 6,762
  • 4
  • 51
  • 81
  • The verbose property in `mvn dependency:tree` is a boolean. `-Dverbose` and `-Dverbose=true` are synonyms. To set 'null', use `-Dverbose=false`. Can't you do the same with your property? – Luciano van der Veekens May 24 '17 at 15:44
  • Use `Boolean` and don't put tags in pom.xml. – Aleksandr M May 24 '17 at 15:47
  • @LucianovanderVeekens yeah, i would like to do the same, but `Boolean.getBoolean("verbose")` would return `false` if you just mention the property with `-Dverbose` while Maven treats it as `true`. How? I tried to analyse it's source code and discovered that Maven has `@Parameter` annotation but unfortunately did not find where it is processed. – Kirill May 24 '17 at 20:38

0 Answers0