Hi all,

many thanks for Your suggestions. I already check the different plugin
implementations (except tidy-maven-plugin) before writing my post - should
have probably mentioned them in my post, I'm sorry. Unfortunately none of
them really seems to help me with what I like/need to achieve, expect of
the JDom parser approach that was implemented by Robert Scholte for the
maven-release-plugin version 3.0 - which hasn't been continued nor
released for 2 1/2 years now.

@Robert: I'd really like to pick up Your approach. Looks very useful to me,
not only for the maven-release-plugin. If You don't mind, I'd invest a
little time to transfer it to a new library and extend it for my use cases.

@Anton: DecentXML is an interesting library, too. I'll surely remember this
one.

@Matthieu: Besides some other use cases, we basically need this for a
migration of a very huge/complex project setup into a new project layout.
For this, (re)calculate our projects (including dependencies, properties
etc) and we need to continuously transfer changes between old and new
project layout for a transition period.

Best regards
Marc


On Thu, 29 Nov 2018 at 17:11, Marc Rohlfs <pomar...@googlemail.com> wrote:

> 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