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

List parameter in a mojo has strange behaviour

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 3.0.3
    • Component/s: Plugins and Lifecycle
    • Labels:
      None
    • Environment:
      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

            • Assignee:
              bentmann Benjamin Bentmann
              Reporter:
              gdogaru Gabriel Dogaru

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment