The tidy-maven-plugin is fairly strict about formatting, and follows the
official Maven POM style guide. You could look at how they're doing it, or
run the plugin after you make your changes to reformat everything.

http://www.mojohaus.org/tidy-maven-plugin/


On Fri, Nov 30, 2018 at 10:39 AM Bernd Eckenfels <[email protected]>
wrote:

> The Release Plugin does rewrite branch/version and does an exceptionally
> bad job since you have to manually configure the indention. Would be good
> to have a common utility for that.
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
>
> ________________________________
> Von: Marc Rohlfs <[email protected]>
> Gesendet: Freitag, November 30, 2018 1:42 AM
> An: [email protected]
> Betreff: How to rewrite POMs retaining the XML structure
>
> Hi all,
>
> is there a way to rewrite pom.xml files without loosing formatting,
> ordering and comments?
>
> We need to (programmatically) do several changes on Maven POMs, e.g. adding
> and removing dependencies and properties. Currently we're using
> the MavenXpp3Reader and MavenXpp3Writer classes to read and write the
> pom.xml files, but in the output files, all comments are removed, the XML
> nodes are reordered and formatting (indentations, empty lines) is lost.
> Does anybody know a way how to read and write POM files without loosing
> formatting ordering and comments?
>
> Best regards
> Marc
>

Reply via email to