Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Auto Closed
-
2.0-beta-6
-
None
-
None
Description
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 )
//
//
// 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 )
//
private final List nonElements = document.getContents(
new Filter() {
public boolean matches(Object obj)
}
);
Format format = Format.getRawFormat();
format.setLineSeparator( LS );
XMLOutputter out = new XMLOutputter( format );
out.putput( nonElements, writer );
out.output( document.getRootElement(), writer );
Attachments
Issue Links
- is related to
-
MRELEASE-255 during a release several elements are removed from the pom.xml (which should be left there)
- Closed
- relates to
-
MRELEASE-850 mvn release:prepare reformats pom.xml comments
- Closed