Model model = new MavenXpp3Reader().read(new StringReader(pomAsString));
POM gavModel = new POM(
model.getName(),
model.getDescription(),
new GAV(
(model.getGroupId() == null ? model.getParent().getGroupId() : model.getGroupId()),
(model.getArtifactId() == null ? model.getParent().getArtifactId() : model.getArtifactId()),
(model.getVersion() == null ? model.getParent().getVersion() : model.getVersion())
)
);
if (model.getParent() != null) {
gavModel.setParent(new GAV(model.getParent().getGroupId(), model.getParent().getArtifactId(), model.getParent().getVersion()));
}
gavModel.getModules().clear();
for (String module : model.getModules()) {
gavModel.getModules().add(module);