Due to popular demand I moved the latest code for parsing a Maven POM (including it’s parent POMs) into a tiny Github Project:
https://github.com/fuinorg/utils4maven
Here is a short example how to use it:
// Reading the model loads everything from remote // repository using JBoss Shrinkwrap Resolver! Model model = MavenPomReader.readModel("org.fuin:objects4j:0.6.1"); System.out.println(model.getName()); // Should print 'Objects4J'
A full example can be found here: MavenPomReaderTest.java
The code on github seems to have an error. The code calls “Utils4J.replaceVars()”:
Utils4J.replaceVars(version, model.getProperties() // Params: String, Properties
Utils4J.replaceVars(pomXml, vars) // Params: String, Map
Although the Utils4J class includes a method with that name, its signature doesn’t match either of the above.
Thanks for the hint. I guess this is because the signature of “replaceVars” in the utilities was changed. I created an issue for this: https://github.com/fuinorg/utils4maven/issues/4