You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jeffrey Hagelberg (JIRA)" <ji...@codehaus.org> on 2013/01/25 17:09:13 UTC

[jira] (MNG-5426) plugin configuration using alias is ignored for array types

Jeffrey Hagelberg created MNG-5426:
--------------------------------------

             Summary: plugin configuration using alias is ignored for array types
                 Key: MNG-5426
                 URL: https://jira.codehaus.org/browse/MNG-5426
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Inheritance and Interpolation
    Affects Versions: 2.0.10
         Environment: Windows XP
            Reporter: Jeffrey Hagelberg


In our pom.xml, we are configuration a plugin using the alias rather than the plugin parameter name.  The configuration we are using is something like:

<configuration>
    <models>
        <model>
            <groupId>com.ibm.mmi.models</groupId>
            <artifactId>mmi_compiled_archive</artifactId>
            <version>${project.version}</version>
        </model>
    </models>
</configuration>

This is configuring the following plugin parameter in our Mojo:

    /**
     * 
     * @parameter alias="models"
     * @required
     */
    private Model[] models_;


When we run our build it fails with:


[INFO] One or more required plugin parameters are invalid/missing for 'xmeta-installer:deploy-models'

[0] Inside the definition for plugin 'xmeta-installer-plugin' specify the following:

<configuration>
  ...
  <models_>VALUE</models_>
</configuration>

-OR-

<configuration>
  ...
  <models>VALUE</models>
</configuration>

This happens despite the fact that the "models" configuration element is present.

I spent some time in a debugger trying to figure out what was going on.  I stepped through the logic in DefaultPluginManager.mergeMojoConfiguration and DefaultPluginManager.buildTopDownMergedConfiguration.  What I see is that 
in "fromPom" maven is implicitly adding an <models_/> tag to the configuration in the pom.xml and treating that as the dominant configuration.  The logic is merging this tag with the real <models/> tag in the plugin configuration, using that as the "recessive" value.  The merge logic only looks at the child elements in the dominant configuration.  In this case, there are none, so the merged configuration does not have the configuraition that was put into the pom.xml.

Here is what I see in the debugger:

pomConfig [ at DefaultPluginManager:1199 ]

<configuration>

 <models>
  <model>
   <groupId>com.ibm.mmi.models</groupId>
   <artifactId>mmi_compiled_archive</artifactId>
   <version>9.2-SNAPSHOT</version>
  </model>
 </models>

 <models_/>
</configuration>


dominant parameter seen in buildTopDownMergedConfiguration:

<models_>
</models_>

recessive parameter seen in buildTopDownMergedConfiguration:

<models>
 <model>
  <groupId>com.ibm.mmi.models</groupId>
  <artifactId>mmi_compiled_archive</artifactId>
  <version>9.2-SNAPSHOT</version>
 </model>
</models>

result of buildTopDownMergedConfiguration:

<models_>
</models_>



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira