maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerome Lacoste" <>
Subject not possible to use empty values in Collection for plugin configuration.
Date Thu, 09 Aug 2007 09:46:24 GMT

[This question is highly related to plexus]

How does one pass an empty value in the configuration of a plugin ? I
am facing the problem using the exec plugin where I need to
conditionally enable a parameter based on a profile. It looks like
maven doesn't differentiate between empty elements in an array.

in <arguments><argument></argument></arguments>

I've tried

<argument> </argument>
<argument><![CDATA[ ]]></argument> (I also tried with tabs)

<argument>" "</argument>
<argument>' '</argument>

The first 3 are treated identically and the argument is filled with
null in the plugin config.
The last two break the command to execute.

I followed the maven code and it looks like a limitation in
plexus-container, probably because of overzealous trimming. To me this
is a limitation. Why is the parser removing content from my config ?

Is this something we want to fix ? I doubt as it would not be backward

Any workaround to achieve my goal ? I know I can create a different
configuration in my profile but that duplicate a lots of code for not
much gain.

In the worst case, I can change the exec mojo to just ignore those
empty values. But that will only solve the problem for my plugin.



ExecMojo code extract:

134             if ( arguments != null )
135             {
136                 for ( int i = 0; i < arguments.size(); i++ )
137                 {
138                     Object argument = arguments.get( i );
139                     String arg;
140                     if ( argument == null )
141                     {
142                         throw new MojoExecutionException(
143                             "Misconfigured argument, value is
null. Set the argument to an empty value"
144                             + " if this is the required behaviour." );



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message