You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Marc Rohlfs <po...@googlemail.com.INVALID> on 2018/12/03 10:47:58 UTC

Re: How to rewrite POMs retaining the XML structure

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 <po...@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
>

Re: How to rewrite POMs retaining the XML structure

Posted by Marc Rohlfs <po...@googlemail.com.INVALID>.
Hi Robert,

took me some days, but today I can finally come up with an update on this:

I moved the relevant sources (and all Your regarding commits) to a new
project/repository and extended them for our needs. My idea on this is to
provide it as a helper library that can be used for more than only the
release plugin.

Please have a look at https://github.com/CoreMedia/maven-jdom-parser and
let me know what you think about it. I'd like to know it You think it could
be worth it continuing it as (sort of) central library for POM
modifications. May be could/should have some further (on- or off-list)
conversation about it.

Best regards
Marc



On Mon, 3 Dec 2018 at 16:50, Robert Scholte <rf...@apache.org> wrote:

> On Mon, 03 Dec 2018 11:47:58 +0100, Marc Rohlfs
> <po...@googlemail.com.invalid> wrote:
>
> > 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.
>
> That would be great. I guess I was working on it before I had to switch
> to
> JPMS/Project Jigsaw support.
> Since then focus was on keeping all our ~100 subprojects running on more
> Java versions.
> The maven-release-plugin is not dead. There are more things that should
> be
> improved for 3.0.0, but based on business value I need to focus on other
> topics. Will definitely work on it again in the future!
>
> Robert
>
> >
> > @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 <po...@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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to rewrite POMs retaining the XML structure

Posted by Robert Scholte <rf...@apache.org>.
On Mon, 03 Dec 2018 11:47:58 +0100, Marc Rohlfs  
<po...@googlemail.com.invalid> wrote:

> 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.

That would be great. I guess I was working on it before I had to switch to  
JPMS/Project Jigsaw support.
Since then focus was on keeping all our ~100 subprojects running on more  
Java versions.
The maven-release-plugin is not dead. There are more things that should be  
improved for 3.0.0, but based on business value I need to focus on other  
topics. Will definitely work on it again in the future!

Robert

>
> @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 <po...@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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org