You say you do modification in the POM to add/remove dependencies &
properties.
Do you really need to modify the pom.xml of your project for that?
You could also do those additions using a plugin/extension and work on the
POM and just deploy a materialized pom.xml from the POM for publication
purposes without having to touch the original pom.xml file.

Matthieu

On Fri, Nov 30, 2018 at 12:13 PM Matthieu BROUILLARD <matth...@brouillard.fr>
wrote:

> @Marc Rohlfs : AFAIK if you do a modification in the POM (as project
> object model) in memory (via a plugin probably) then the pom.xml file is
> already behind you and comments are already lost during the loading phase
> of the POM. Whatever the materialization of the POM you choose, comments
> will be lost.
>
>
> On Fri, Nov 30, 2018 at 9:57 AM Oliver B. Fischer <
> o.b.fisc...@swe-blog.net> wrote:
>
>> I do it with the release tools for jQAssitant with XSLT like this
>>
>> https://github.com/buschmais/jqa-release-tool/blob/master/core/src/main/resources/xsl/update-version-property.xsl
>>
>> The Versions plugin does it via Stax.
>>
>> Best,
>>
>> Oliver
>>
>> Am 29.11.18 um 17:11 schrieb Marc Rohlfs:
>> > 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
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>

Reply via email to