use of org.commonjava.maven.galley.maven.GalleyMavenException in project galley by Commonjava.
the class MavenModelProcessor method readRelationships.
public EProjectDirectRelationships readRelationships(final MavenPomView pomView, final URI source, final ModelProcessorConfig discoveryConfig) throws GalleyMavenException {
final boolean includeManagedDependencies = discoveryConfig.isIncludeManagedDependencies();
final boolean includeBuildSection = discoveryConfig.isIncludeBuildSection();
final boolean includeManagedPlugins = discoveryConfig.isIncludeManagedPlugins();
logger.info("Reading relationships for: {}\n (from: {})", pomView.getRef(), source);
try {
final ProjectVersionRef projectRef = pomView.getRef();
final EProjectDirectRelationships.Builder builder = new EProjectDirectRelationships.Builder(source, projectRef);
addParentRelationship(source, builder, pomView, projectRef);
addDependencyRelationships(source, builder, pomView, projectRef, includeManagedDependencies);
if (includeBuildSection) {
addExtensionUsages(source, builder, pomView, projectRef);
addPluginUsages(source, builder, pomView, projectRef, includeManagedPlugins);
}
return builder.build();
} catch (final InvalidVersionSpecificationException e) {
throw new GalleyMavenException("Failed to parse version for model: {}. Reason: {}", e, pomView, e.getMessage());
} catch (final IllegalArgumentException e) {
throw new GalleyMavenException("Failed to parse relationships for model: {}. Reason: {}", e, pomView, e.getMessage());
}
}
use of org.commonjava.maven.galley.maven.GalleyMavenException in project indy by Commonjava.
the class ImpliedRepositoryDetector method initJob.
private boolean initJob(final ImplicationsJob job) {
switch(job.event.getType()) {
case DOWNLOAD:
case UPLOAD:
break;
default:
// we're not interested in these.
return false;
}
final Transfer transfer = job.transfer;
if (!transfer.getPath().endsWith(".pom")) {
return false;
}
final Location location = transfer.getLocation();
if (!(location instanceof KeyedLocation)) {
return false;
}
final StoreKey key = ((KeyedLocation) location).getKey();
try {
job.store = storeManager.getArtifactStore(key);
} catch (final IndyDataException e) {
logger.error(String.format("Cannot retrieve artifact store for: %s. Failed to process implied repositories.", key), e);
}
if (job.store == null) {
return false;
}
job.pathInfo = ArtifactPathInfo.parse(transfer.getPath());
if (job.pathInfo == null) {
return false;
}
try {
logger.debug("Parsing: {}", transfer);
job.pomView = pomReader.readLocalPom(job.pathInfo.getProjectId(), transfer, MavenPomView.ALL_PROFILES);
} catch (final GalleyMavenException e) {
logger.error(String.format("Cannot parse: %s from: %s. Failed to process implied repositories.", job.pathInfo.getProjectId(), transfer), e);
}
return job.pomView != null;
}
Aggregations