You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (JIRA)" <ji...@codehaus.org> on 2013/02/04 23:35:13 UTC

[jira] (MPH-78) effective-pom creates invalid xml because it outputs the Resource.mergeId

     [ https://jira.codehaus.org/browse/MPH-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte updated MPH-78:
------------------------------

    Component/s: effective-pom
    
> effective-pom creates invalid xml because it outputs the Resource.mergeId
> -------------------------------------------------------------------------
>
>                 Key: MPH-78
>                 URL: https://jira.codehaus.org/browse/MPH-78
>             Project: Maven 2.x Help Plugin
>          Issue Type: Bug
>          Components: effective-pom
>    Affects Versions: 2.1.1
>            Reporter: Jacob Robertson
>            Priority: Minor
>
> My organization would like to use the output from the effective-pom goal as part of the deployed meta data in an ear.  This is useful for some of our scripting that needs properties and dependencyManagement versions resolved (i.e. from parent poms), and the pom that is currently put in the ear does not have that information.  However, once we start generating the effective-pom.xml file, any tool that uses xml validation will notice that the mergeId tag is invalid.  This is especially annoying in eclipse, as it marks the whole project as having an error due to the effective-pom.xml file being in the target directory under the eclipse project.  We can of course turn the xml validation off for the eclipse project or folder, but this is one additional step to ask a multitude of developers to take in configuring their projects.
> I notice that the EffectivePomMojo class has a "cleanModel" method that appears to sort the properties.  Just to play with this, I added a "cleanResources" method that calls Resource.setMergeId(null).  This technique does in fact work as I hoped for outputting the xml without the mergeId, but it requires upgrading this plugin to use at least Maven 2.0.10.
> {code}
> private static void cleanModel( Model pom )
> {
>     Properties properties = new SortedProperties();
>     properties.putAll( pom.getProperties() );
>     pom.setProperties( properties );
>     cleanResources( pom.getBuild().getResources() );
>     cleanResources( pom.getBuild().getTestResources() );
> }
> private static void cleanResources( List resources )
> {
>     for ( Iterator i = resources.iterator(); i.hasNext(); )
>     {
>         Resource resource = (Resource) i.next();
>         resource.setMergeId( null );
>     }
> }
> {code}

--
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