You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jerome Lacoste <je...@gmail.com> on 2007/08/09 11:46:24 UTC

not possible to use empty values in Collection for plugin configuration.

Hei,

[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> </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
compatible.

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.

Cheers,

Jerome

ExecMojo code extract:

http://mojo.codehaus.org/exec-maven-plugin/xref/org/codehaus/mojo/exec/ExecMojo.html

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." );


Cheers,

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org