use of org.commonjava.maven.atlas.ident.ref.ArtifactRef in project galley by Commonjava.
the class MavenModelProcessor method addDependencies.
private void addDependencies(final List<DependencyView> deps, final ProjectVersionRef projectRef, final Builder builder, final URI source, final boolean managed) {
if (deps != null) {
for (final DependencyView dep : deps) {
try {
final ProjectVersionRef ref = dep.asProjectVersionRef();
final String profileId = dep.getProfileId();
final URI location = RelationshipUtils.profileLocation(profileId);
final ArtifactRef artifactRef = new SimpleArtifactRef(ref, dep.getType(), dep.getClassifier());
// force the InvalidVersionSpecificationException.
artifactRef.getVersionSpec();
Set<ProjectRefView> exclusionsView = dep.getExclusions();
ProjectRef[] excludes;
if (exclusionsView != null && !exclusionsView.isEmpty()) {
excludes = new ProjectRef[exclusionsView.size()];
int i = 0;
for (ProjectRefView exclusionView : exclusionsView) {
excludes[i] = exclusionView.asProjectRef();
i++;
}
} else {
excludes = new ProjectRef[0];
}
builder.withDependencies(new SimpleDependencyRelationship(source, location, projectRef, artifactRef, dep.getScope(), builder.getNextDependencyIndex(managed), managed, dep.getOriginInfo().isInherited(), dep.isOptional(), excludes));
} catch (final InvalidRefException e) {
logger.error(String.format("%s: dependency is invalid! Reason: %s. Skipping:\n\n%s\n\n", projectRef, e.getMessage(), dep.toXML()), e);
} catch (final InvalidVersionSpecificationException e) {
logger.error(String.format("%s: dependency is invalid! Reason: %s. Skipping:\n\n%s\n\n", projectRef, e.getMessage(), dep.toXML()), e);
} catch (final GalleyMavenException e) {
logger.error(String.format("%s: dependency is invalid! Reason: %s. Skipping:\n\n%s\n\n", projectRef, e.getMessage(), dep.toXML()), e);
}
}
}
}
use of org.commonjava.maven.atlas.ident.ref.ArtifactRef in project indy by Commonjava.
the class KojiContentManagerDecorator method findKojiBuildAnd.
private <T> T findKojiBuildAnd(ArtifactStore store, String path, EventMetadata eventMetadata, T defValue, KojiBuildAction<T> action) throws IndyWorkflowException {
if (!config.getEnabled()) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("Koji content-manager decorator is disabled.");
return defValue;
}
Group group = (Group) store;
if (!config.isEnabledFor(group.getName())) {
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("Koji content-manager decorator not enabled for: {}.", store.getKey());
return defValue;
}
Logger logger = LoggerFactory.getLogger(getClass());
// TODO: This won't work for maven-metadata.xml files! We need to hit a POM or jar or something first.
ArtifactPathInfo pathInfo = ArtifactPathInfo.parse(path);
if (pathInfo != null) {
ArtifactRef artifactRef = pathInfo.getArtifact();
logger.info("Searching for Koji build: {}", artifactRef);
return proxyKojiBuild(store.getKey(), artifactRef, path, eventMetadata, defValue, action);
} else {
logger.info("Path is not a maven artifact reference: {}", path);
}
return defValue;
}
Aggregations