final PackagingType packaging = PackagingType
.of(artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension()));
final String classifier = artifact.getClassifier().length() == 0 ? packaging.getClassifier() : artifact.getClassifier();
final MavenCoordinate coordinate = MavenCoordinates.createCoordinate(artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion(), packaging, classifier);
// SHRINKRES-123 Allow for depMgt explicitly not setting scope
final String resolvedScope = dependency.getScope();
final boolean undeclaredScope = resolvedScope == null;
// SHRINKRES-143 lets ignore invalid scope
ScopeType scope = ScopeType.RUNTIME;
try {
scope = ScopeType.fromScopeType(resolvedScope);
} catch (IllegalArgumentException e) {
// let scope be RUNTIME
log.log(Level.WARNING, "Invalid scope {0} of dependency {1} will be replaced by <scope>runtime</scope>",
new Object[] { dependency.getScope(), coordinate.toCanonicalForm() });
}
final MavenDependencySPI result = new MavenDependencyImpl(coordinate, scope,
dependency.isOptional(), undeclaredScope, exclusions.toArray(TYPESAFE_EXCLUSIONS_ARRAY));
return result;