public POM toModel(String pomAsString)
throws IOException, XmlPullParserException {
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);
gavModel.setMultiModule( true );
}
for (Repository repository : model.getRepositories()) {
gavModel.addRepository(fromPomModelToClientModel(repository));
}
for (Dependency dependency : model.getDependencies()) {
gavModel.getDependencies().add(fromPomModelToClientModel(dependency));
}
return gavModel;
}