I have a plugin configuration parameter named suffix
. I would like the user to be able to specify a newline (a literal character produced by pressing the Return
key, not some escaped variant, although I'll get to that) as the value for that parameter.
At the same time, the parameter has a default-value
setting. I would like to continue to use that.
How do I specify, in my plugin's configuration stanza, that the suffix
parameter should take a newline?
I've tried this:
<suffix><![CDATA[
]]></suffix>
...and this:
<suffix>${line.separator}</suffix>
...(that one actually substitutes the right character in but XML parsing stomps on it) and this:
<suffix><[!CDATA[${line.separator}]]></suffix>
...and this:
<suffix>&x0d;</suffix>
...and this:
<suffix xml:space="preserve">
</suffix>
...all to no avail. Specifically, I see the default value of the parameter instead.
Edit: Interestingly, the whitespace is eaten long before Maven's internals ever get a chance to work on the value. mvn help:effective-pom
will show that the whitespace has been removed. Leading, trailing and "only" whitespace content is removed early on in the parsing stage.
This seems to me most likely to be a bug, so I've filed http://jira.codehaus.org/browse/PLX-461 to track it.
The codehaus links don't work anymore, but I found in the maven documentation that since version 3.0.something you can add an attribute xml:space="preserve" to any element you don't want trimmed.
Per instructions, I am answering this question by referring people to the following JIRA: https://issues.apache.org/jira/browse/MNG-5380 (originally at http://jira.codehaus.org/browse/PLX-461 ).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With