[ 
https://issues.apache.org/jira/browse/MPH-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14935759#comment-14935759
 ] 

Michael Osipov commented on MPH-78:
-----------------------------------

Is this still valid? Can you provide a sample project?

> effective-pom creates invalid xml because it outputs the Resource.mergeId
> -------------------------------------------------------------------------
>
>                 Key: MPH-78
>                 URL: https://issues.apache.org/jira/browse/MPH-78
>             Project: Maven 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to