Content outside root elements in pom are not transfered to the release poms
---------------------------------------------------------------------------
Key: MRELEASE-266
URL: http://jira.codehaus.org/browse/MRELEASE-266
Project: Maven 2.x Release Plugin
Issue Type: Bug
Affects Versions: 2.0-beta-6
Reporter: Steve Ebersole
The usual convention for copyright/license headers in xml files is b4 the root
element tag, so that it occurs outside the main body (i.e. outside
Document.getRootElement()). My experience is that the release plugin does not
copy such comments over to the release poms (such that the release poms are
missing those headers).
I believe the plugin tries to handle these comments in
org.apache.maven.shared.release.phase.AbstractRewritePomsPhase#transformProject
where it sets up the 'intro' and 'outtro' vars. In my experience, this was not
working. And JDOM provides an easier approach anyway, by filtering the
Document contents for non-Elements (making assumption that <project/> is the
single root) and copying over the filtered content. This would be a simple
change to #writePom:
1) just write out the Document itself?:
...
writer = new FileWriter( pomFile );
// if ( intro != null )
// {
// writer.write( intro );
// }
//
// Format format = Format.getRawFormat();
// format.setLineSeparator( LS );
// XMLOutputter out = new XMLOutputter( format );
// out.output( document.getRootElement(), writer );
//
// if ( outtro != null )
// {
// writer.write( outtro );
// }
Format format = Format.getRawFormat();
format.setLineSeparator( LS );
XMLOutputter out = new XMLOutputter( format );
out.output( document, writer );
2) separate element/non-element:
...
writer = new FileWriter( pomFile );
// if ( intro != null )
// {
// writer.write( intro );
// }
//
// Format format = Format.getRawFormat();
// format.setLineSeparator( LS );
// XMLOutputter out = new XMLOutputter( format );
// out.output( document.getRootElement(), writer );
//
// if ( outtro != null )
// {
// writer.write( outtro );
// }
private final List nonElements = document.getContents(
new Filter() {
public boolean matches(Object obj) {
return obj instanceof Comment || obj instanceof
ProcessingInstruction;
}
}
);
Format format = Format.getRawFormat();
format.setLineSeparator( LS );
XMLOutputter out = new XMLOutputter( format );
out.putput( nonElements, writer );
out.output( document.getRootElement(), writer );
--
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