[
https://issues.apache.org/jira/browse/MRELEASE-266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Osipov closed MRELEASE-266.
-----------------------------------
Resolution: Auto Closed
This issue has been auto closed because it has been inactive for a long period
of time. If you think this issue still applies, retest your problem with the
most recent version of Maven and the affected component, reopen and post your
results.
> Content outside root elements in pom are not transfered to the release poms
> ---------------------------------------------------------------------------
>
> Key: MRELEASE-266
> URL: https://issues.apache.org/jira/browse/MRELEASE-266
> Project: Maven Release Plugin
> Issue Type: Bug
> Components: prepare
> Affects Versions: 2.0-beta-6
> Reporter: Steve Ebersole
> Priority: Major
>
> 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 was sent by Atlassian JIRA
(v7.6.3#76005)