String versionOverride = System.getProperty("version.override");
if (versionOverride != null) {
getLog().info("changing version of pom file and save it to target/pom.xml");
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(pomFile);
Element versionElem = findElement(doc.getRootElement().getChildren(), "version");
if (versionElem == null) {
//version inherited from parent, so get it from there
Element parentElem = findElement(doc.getRootElement().getChildren(), "parent");
versionElem = findElement(parentElem.getChildren(), "version");
}
versionElem.setText(versionOverride);
File targetDir = new File(pomFile.getParent() + "/target");