You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gabriel Dogaru (JIRA)" <ji...@codehaus.org> on 2010/01/28 09:49:55 UTC

[jira] Created: (MNG-4551) List parameter in a mojo has strange behaviour

List parameter in a mojo has strange behaviour
----------------------------------------------

                 Key: MNG-4551
                 URL: http://jira.codehaus.org/browse/MNG-4551
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Plugins and Lifecycle
    Affects Versions: 2.2.1
         Environment: windows, maven 2.2.1, java 1.5.15, gmaven 1.0 rc4
            Reporter: Gabriel Dogaru


I had different problems with a mojo parameter of type list in my Mojo.
I use a parent pom to configure all the plugins used in our projects.
There I give the list 4 values like this, and every module should be able to overwrite this and use any dbs it needs.
 <moduleDbs>
        <moduleDb>metadata</moduleDb>
        <moduleDb>portal</moduleDb>
        <moduleDb>client</moduleDb>
        <moduleDb>model</moduleDb>
 </moduleDbs>

In my mojo I have

  * @parameter 
  * @required
  */
List moduleDbs

1. If I try to use 
  * @parameter expression="${moduleDbs}"
it fails saying it can not initialize the list.

2.I tried to overwrite the configuration in a module with an empty db set.
tried both <moduleDbs/> and <moduleDbs></moduleDbs> but the mojo still had one record in the list
Also I needed to overwrite it with a value that was not in the parent, like
<moduleDbs> <moduleDb>lolisima</moduleDb> </..
and the list also contained metadata from the original configuration.

When I switched the type from List to 
  * @parameter expression="${moduleDbs}"
   * @required
   */
  String[] moduleDbs

everything worked perfectly.

I am not sure if this has something to do with maven core. I am using gmaven and it may be because of the way groovy treats arrays and lists.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-4551) List parameter in a mojo has strange behaviour

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-4551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann closed MNG-4551.
----------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: Issues to be reviewed for 3.x)
                   3.0.3
         Assignee: Benjamin Bentmann

The issue with {{expression}} on plugin parameters using collection interfaces has been fixed in [r1070102|http://svn.apache.org/viewvc?view=revision&revision=1070102].

For the configuration merging during inheritance, please see [Merging Plugin Configuration in Complex Projects|http://www.sonatype.com/people/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/]

> List parameter in a mojo has strange behaviour
> ----------------------------------------------
>
>                 Key: MNG-4551
>                 URL: http://jira.codehaus.org/browse/MNG-4551
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Plugins and Lifecycle
>    Affects Versions: 2.2.1
>         Environment: windows, maven 2.2.1, java 1.5.15, gmaven 1.0 rc4
>            Reporter: Gabriel Dogaru
>            Assignee: Benjamin Bentmann
>             Fix For: 3.0.3
>
>
> I had different problems with a mojo parameter of type list in my Mojo.
> I use a parent pom to configure all the plugins used in our projects.
> There I give the list 4 values like this, and every module should be able to overwrite this and use any dbs it needs.
>  <moduleDbs>
>         <moduleDb>metadata</moduleDb>
>         <moduleDb>portal</moduleDb>
>         <moduleDb>client</moduleDb>
>         <moduleDb>model</moduleDb>
>  </moduleDbs>
> In my mojo I have
>   * @parameter 
>   * @required
>   */
> List moduleDbs
> 1. If I try to use 
>   * @parameter expression="${moduleDbs}"
> it fails saying it can not initialize the list.
> 2.I tried to overwrite the configuration in a module with an empty db set.
> tried both <moduleDbs/> and <moduleDbs></moduleDbs> but the mojo still had one record in the list
> Also I needed to overwrite it with a value that was not in the parent, like
> <moduleDbs> <moduleDb>lolisima</moduleDb> </..
> and the list also contained metadata from the original configuration.
> When I switched the type from List to 
>   * @parameter expression="${moduleDbs}"
>    * @required
>    */
>   String[] moduleDbs
> everything worked perfectly.
> I am not sure if this has something to do with maven core. I am using gmaven and it may be because of the way groovy treats arrays and lists.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira