Writing poms from mojos

2015-08-26 Thread Barrie Treloar
The release plugin has AbstractRewritePomsPhase which uses a lot of private methods to do its work. Is there a more utilitarian way of writing a pom? I really only need to fiddle with a couple of values in an existing pom (keeping whitespaces/formatting/etc) and re-write it.

Re: Writing poms from mojos

2015-08-26 Thread Robert Scholte
I still have this wish to replace the JDom implementation with Woodstox, so all kinds of dirty tricks can be removed. I would gamble on that approach. Robert Op Wed, 26 Aug 2015 09:40:09 +0200 schreef Barrie Treloar : The release plugin has AbstractRewritePomsPhase which uses a lot of pr

Re: Writing poms from mojos

2015-08-26 Thread Barrie Treloar
On 26 August 2015 at 20:10, Robert Scholte wrote: > I still have this wish to replace the JDom implementation with Woodstox, > so all kinds of dirty tricks can be removed. > I would gamble on that approach. I can't wait :) My itch is already burning so I'll live with the damned version now. I

Re: Writing poms from mojos

2015-08-26 Thread Robert Scholte
depending on what you want, maybe flattened-maven-plugin[1] can come to the rescue. [1] http://www.mojohaus.org/flatten-maven-plugin/ Op Wed, 26 Aug 2015 13:07:14 +0200 schreef Barrie Treloar : On 26 August 2015 at 20:10, Robert Scholte wrote: I still have this wish to replace the JD

Re: Writing poms from mojos

2015-08-26 Thread Barrie Treloar
On 26 August 2015 at 20:41, Robert Scholte wrote: > depending on what you want, maybe flattened-maven-plugin[1] can come to > the rescue. I need the mojo I am hacking to rewrite the pom's to bend to my will. I'm probably a week away from having a working git magic plugin working.

Re: Writing poms from mojos

2015-08-28 Thread Igor Fedorenko
I used decentxml quite successfully for this purpose in Tycho and elsewhere. -- Regards, Igor On August 26, 2015 3:40:13 AM Barrie Treloar wrote: The release plugin has AbstractRewritePomsPhase which uses a lot of private methods to do its work. Is there a more utilitarian way of writing a

Re: Writing poms from mojos

2015-08-29 Thread Jason van Zyl
+1 jvz > On Aug 26, 2015, at 7:20 AM, Igor Fedorenko wrote: > > I used decentxml quite successfully for this purpose in Tycho and elsewhere. > > -- > Regards, > Igor > > > >> On August 26, 2015 3:40:13 AM Barrie Treloar wrote: >> >> The release plugin has AbstractRewritePomsPhase which us

Re: Writing poms from mojos

2015-08-29 Thread Mirko Friedenhagen
Hello Barrie, I need something to introduce a parent element in our company pom. The idea is to make e.g. spring-boot the uppermost parent or to introduce needed dependencies and reconfigure mojos for this while keeping the rest in sync. I was thinking about writing a plugin for this as well. Reg

Re: Writing poms from mojos

2015-08-29 Thread Barrie Treloar
So, I'm sensing that rewriting the pom is a free-for-all and not something we do through a Maven API.

Re: Writing poms from mojos

2015-08-30 Thread Barrie Treloar
I've just looked at versions-maven-plugin, where a custom XMLEventReader (ModifiedPomXMLEventReader) is used to rebuild the pom file. A custom class is used because "StAX API (JSR-173) are not good round-trip rewriting while keeping all unchanged bytes in the file as is. For example, the StAX API

Re: Writing poms from mojos

2015-09-02 Thread Barrie Treloar
There are ~3000 plugins in Maven Central ( http://search.maven.org/#search|ga|1|p%3A%22maven-plugin%22). My eyes glazed over after scanning through the first 100 to see if there are plugin names to indicate if they might re-write poms. So I'll stick with the available plugins list ( http://maven.a

Re: Writing poms from mojos

2015-09-02 Thread jieryn
tidy-maven-plugin rewrites POMs. http://www.mojohaus.org/tidy-maven-plugin/ On Wed, Sep 2, 2015 at 10:13 PM, Barrie Treloar wrote: > There are ~3000 plugins in Maven Central ( > http://search.maven.org/#search|ga|1|p%3A%22maven-plugin%22). My eyes > glazed over after scanning through the first 1

Re: Writing poms from mojos

2015-09-02 Thread Barrie Treloar
tidy-maven-plugin (https://github.com/mojohaus/tidy-maven-plugin) works similar to versions plugin. It uses a String copy of pom and for the non-trivial tidy tasks an XMLEventReader from StAX api to manipulate rewrites, and plexus.util.FileUtils.fileWrite to write the pom file out.

Re: Writing poms from mojos

2015-09-03 Thread Stephen Connolly
Well as the initial author of tidy and versions it should be no surprise that I use the same tricks! I had been working on a verbatim XML pull parser implementation... Always ends up on the back burner. Basically my idea is to store the actual verbatim text in the XML event objects. That way if y

Re: Writing poms from mojos

2015-09-03 Thread Igor Fedorenko
Like I mentioned earlier, tycho-versions-plugin uses decentxml to manipulate pom.xml files. There is more or less complete version refactroing engine implementation there, but actual pom changes go through MutablePomFile [1]. The advantages of decentxml is that it has good and easy to use API and i

Re: Writing poms from mojos

2015-09-03 Thread Barrie Treloar
On 3 September 2015 at 20:49, Igor Fedorenko wrote: > Like I mentioned earlier, tycho-versions-plugin > Thanks, and especially for the link into the source file. That save me effort. I saw Tycho earlier and read m2eclipse. oops.

Re: Writing poms from mojos

2015-09-03 Thread Daniel Kulp
The shade plugin can also create a “dependency reduced” pom. Dan > On Sep 2, 2015, at 10:13 PM, Barrie Treloar wrote: > > There are ~3000 plugins in Maven Central ( > http://search.maven.org/#search|ga|1|p%3A%22maven-plugin%22). My eyes > glazed over after scanning through the first 100 to s

Re: Writing poms from mojos

2015-09-03 Thread Barrie Treloar
On 4 September 2015 at 02:49, Daniel Kulp wrote: > > The shade plugin can also create a “dependency reduced” pom. Thanks. The dependency reduced pom is completely regenerated by MavenJDOMWriter.updateModel and doesn't attempt to keep any of the original pom's formatting. It uses jdom to genera