You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andreas Sewe <se...@st.informatik.tu-darmstadt.de> on 2010/07/21 17:24:52 UTC

Complex-valued maps as plugin parameter possible?

Hi all,

I am writing a Maven plugin and have trouble getting a parameter defined 
as follows to work:

/**
  * @parameter
  */
private Map<String,ComplexObject> map;

Not matter how I configure <map> in my POM, it only ever maps Strings to 
null, not to an instance of ComplexObjext:

<map>
   <key>
     <!-- ComplexObject class lives in same package as mojo -->
     <complexObject>
       <someField>42</someField>
     <complexObject>
   </key>
</map>

But as far a I understand the "Guide to Configuring Plug-ins" 
<http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Maps>, 
the above should work. Alas, it doesn't work even if I add an 
appropriate implementation attribute to <complexObject> (or <key>, for 
that matter).

What's odd is that List<ComplexObject> works fine as parameter -- and 
the aforementioned guide simply states that mapping maps works the "same 
way". But it seems like this is wrong and having complex-valued maps as 
plugin parameter is impossible. :-(

Can someone please shed light on the issue. Thank you.

Best wishes,

Andreas

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


Re: Complex-valued maps as plugin parameter possible?

Posted by Andreas Sewe <se...@st.informatik.tu-darmstadt.de>.
Hi all,

any takers for this one?

> I am writing a Maven plugin and have trouble getting a parameter defined 
> as follows to work:
> 
> /**
>  * @parameter
>  */
> private Map<String,ComplexObject> map;
> 
> Not matter how I configure <map> in my POM, it only ever maps Strings to 
> null, not to an instance of ComplexObjext:
> 
> <map>
>   <key>
>     <!-- ComplexObject class lives in same package as mojo -->
>     <complexObject>
>       <someField>42</someField>
>     <complexObject>
>   </key>
> </map>
> 
> But as far a I understand the "Guide to Configuring Plug-ins" 
> <http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Maps>, 
> the above should work. Alas, it doesn't work even if I add an 
> appropriate implementation attribute to <complexObject> (or <key>, for 
> that matter).
> 
> What's odd is that List<ComplexObject> works fine as parameter -- and 
> the aforementioned guide simply states that mapping maps works the "same 
> way". But it seems like this is wrong and having complex-valued maps as 
> plugin parameter is impossible. :-(
> 
> Can someone please shed light on the issue. Thank you.

Best wishes,

Andreas


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