effective-pom creates invalid xml because it outputs the Resource.mergeId
-------------------------------------------------------------------------
Key: MPH-78
URL: http://jira.codehaus.org/browse/MPH-78
Project: Maven 2.x Help Plugin
Issue Type: Bug
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 contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira