use of org.commonjava.maven.galley.maven.model.view.DocRef in project galley by Commonjava.
the class MavenPomReader method read.
public MavenPomView read(final ProjectVersionRef ref, final Transfer pom, final List<? extends Location> locations, final EventMetadata eventMetadata, final String... activeProfileLocations) throws GalleyMavenException {
final List<DocRef<ProjectVersionRef>> stack = new ArrayList<DocRef<ProjectVersionRef>>();
DocRef<ProjectVersionRef> dr;
try {
dr = getDocRef(ref, pom, false, eventMetadata);
} catch (final TransferException e) {
throw new GalleyMavenException("Failed to retrieve POM for: {}, {} levels deep in ancestry stack of: {}. Reason: {}", e, ref, stack.size(), ref, e.getMessage());
}
stack.add(dr);
ProjectVersionRef next = xml.getParentRef(dr.getDoc());
while (next != null && dr != null) {
try {
dr = getDocRef(next, locations, false, eventMetadata);
} catch (final TransferException e) {
throw new GalleyMavenException("Failed to retrieve POM for: {}, {} levels deep in ancestry stack of: {}. Reason: {}", e, next, stack.size(), ref, e.getMessage());
}
if (dr == null) {
throw new GalleyMavenException("Cannot resolve {}, {} levels dep in the ancestry stack of: {}", next, stack.size(), ref);
}
stack.add(dr);
next = xml.getParentRef(dr.getDoc());
}
final MavenPomView view = new MavenPomView(ref, stack, xpath, pluginDefaults, pluginImplications, xml, activeProfileLocations);
assembleImportedInformation(view, locations);
logStructure(view);
return view;
}
Aggregations