[ 
https://issues.apache.org/jira/browse/MNG-5426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov closed MNG-5426.
-------------------------------
    Resolution: Auto Closed

This issue has been auto closed because it has been inactive for a long period 
of time. If you think this issue still applies, retest your problem with the 
most recent version of Maven and the affected component, reopen and post your 
results.

> plugin configuration using alias is ignored for array types
> -----------------------------------------------------------
>
>                 Key: MNG-5426
>                 URL: https://issues.apache.org/jira/browse/MNG-5426
>             Project: Maven
>          Issue Type: Bug
>          Components: Inheritance and Interpolation
>    Affects Versions: 2.0.10
>         Environment: Windows XP
>            Reporter: Jeffrey Hagelberg
>            Priority: Major
>
> 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 was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to