Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4551

List parameter in a mojo has strange behaviour

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 3.0.3
    • Plugins and Lifecycle
    • None
    • windows, maven 2.2.1, java 1.5.15, gmaven 1.0 rc4

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              gdogaru Gabriel Dogaru
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: