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 it provides "perfect" file-model-file
roundtrip.

[1]
http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-release/tycho-versions-plugin/src/main/java/org/eclipse/tycho/versions/pom/MutablePomFile.java

-- 
Regards,
Igor

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 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.apache.org/plugins/) and it looks like the only plugins that
> modify the pom are:
> * release
> * versions
> 
> I've also looked at m2eclipse (https://github.com/eclipse/m2e-core.git)
> to
> see how it rewrites poms. m2eclipse can get away with working with the
> Eclipse provided StructuredModels to grab a dom version of the editor and
> just rewrite that one section, knowing that it doesn't need to rewrite
> the
> whole file.
> 
> The Maven plugins on the other hand need to stream in the file and
> preserve
> all the kooky white space and commenting, as well as update just the
> sections they want to modify.
> 
> The release plugin uses org.jdom.Element to manipulate rewrites, and
> org.jdom.output.XMLOutputter with a raw formatter to write the pom file
> out.
> 
> The versions plugin uses StringBuilder as an in memory copy of the pom
> file
> and the StAX2 api to manipulate rewrites, and an XmlStreamWriter to write
> the pom file out.
> 
> Have I missed any plugins?
> 
> For such a small number of plugins that need to make rewrites it probably
> not necessary to have this functionality offered in Maven directly...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to