scopes = new ScopeType[] { ScopeType.fromScopeType(scope) };
public MavenDependency createMavenDependency(final ArtifactSpec spec) { final MavenCoordinate newCoordinate = MavenCoordinates.createCoordinate( spec.groupId(), spec.artifactId(), spec.version(), PackagingType.of(spec.type()), spec.classifier()); return MavenDependencies.createDependency(newCoordinate, ScopeType.fromScopeType(spec.scope), false); }
scope = ScopeType.fromScopeType(resolvedScope); } catch (IllegalArgumentException e) {
scope = ScopeType.fromScopeType(resolvedScope); } catch (IllegalArgumentException e) {
public static MavenDependency fromDependency(final Dependency dependency) { final Artifact artifact = dependency.getArtifact(); 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-143 lets ignore invalid scope ScopeType scope = ScopeType.RUNTIME; try { scope = ScopeType.fromScopeType(dependency.getScope()); } 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 MavenDependency result = MavenDependencies.createDependency(coordinate, scope, dependency.isOptional(), fromExclusions(dependency.getExclusions()).toArray(TYPESAFE_EXCLUSIONS_ARRAY)); return result; }
public static MavenDependency fromDependency(final Dependency dependency) { final Artifact artifact = dependency.getArtifact(); 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-143 lets ignore invalid scope ScopeType scope = ScopeType.RUNTIME; try { scope = ScopeType.fromScopeType(dependency.getScope()); } 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 MavenDependency result = MavenDependencies.createDependency(coordinate, scope, dependency.isOptional(), fromExclusions(dependency.getExclusions()).toArray(TYPESAFE_EXCLUSIONS_ARRAY)); return result; }
/** * Creates MavenArtifactInfo based on DependencyNode. * * @param dependencyNode * dependencyNode * @return The new {@link MavenArtifactInfo> instance. */ static MavenArtifactInfo fromDependencyNode(final DependencyNode dependencyNode) { final Artifact artifact = dependencyNode.getDependency().getArtifact(); final List<DependencyNode> children = dependencyNode.getChildren(); // SHRINKRES-143 lets ignore invalid scope ScopeType scopeType = ScopeType.RUNTIME; try { scopeType = ScopeType.fromScopeType(dependencyNode.getDependency().getScope()); } catch (IllegalArgumentException e) { // let scope be RUNTIME log.log(Level.WARNING, "Invalid scope {0} of retrieved dependency {1} will be replaced by <scope>runtime</scope>", new Object[] { dependencyNode.getDependency().getScope(), dependencyNode.getDependency().getArtifact() }); } final boolean optional = dependencyNode.getDependency().isOptional(); return new MavenArtifactInfoImpl(artifact, scopeType, children, optional); }
/** * Creates MavenArtifactInfo based on DependencyNode. * * @param dependencyNode * dependencyNode * @return The new {@link MavenArtifactInfo> instance. */ static MavenArtifactInfo fromDependencyNode(final DependencyNode dependencyNode) { final Artifact artifact = dependencyNode.getDependency().getArtifact(); final List<DependencyNode> children = dependencyNode.getChildren(); // SHRINKRES-143 lets ignore invalid scope ScopeType scopeType = ScopeType.RUNTIME; try { scopeType = ScopeType.fromScopeType(dependencyNode.getDependency().getScope()); } catch (IllegalArgumentException e) { // let scope be RUNTIME log.log(Level.WARNING, "Invalid scope {0} of retrieved dependency {1} will be replaced by <scope>runtime</scope>", new Object[] { dependencyNode.getDependency().getScope(), dependencyNode.getDependency().getArtifact() }); } final boolean optional = dependencyNode.getDependency().isOptional(); return new MavenArtifactInfoImpl(artifact, scopeType, children, optional); }
/** * Creates MavenResolvedArtifact based on ArtifactResult. * * @param artifactResult * @return */ static MavenResolvedArtifact fromArtifactResult(final ArtifactResult artifactResult) { final Artifact artifact = artifactResult.getArtifact(); final DependencyNode root = artifactResult.getRequest().getDependencyNode(); // SHRINKRES-143 lets ignore invalid scope ScopeType scopeType = ScopeType.RUNTIME; try { scopeType = ScopeType.fromScopeType(root.getDependency().getScope()); } catch (IllegalArgumentException e) { // let scope be RUNTIME log.log(Level.WARNING, "Invalid scope {0} of retrieved dependency {1} will be replaced by <scope>runtime</scope>", new Object[] { root.getDependency().getScope(), root.getDependency().getArtifact() }); } final List<DependencyNode> children = root.getChildren(); final boolean optional = root.getDependency().isOptional(); return new MavenResolvedArtifactImpl(artifact, scopeType, children, optional); }
/** * Creates MavenResolvedArtifact based on ArtifactResult. * * @param artifactResult * @return */ static MavenResolvedArtifact fromArtifactResult(final ArtifactResult artifactResult) { final Artifact artifact = artifactResult.getArtifact(); final DependencyNode root = artifactResult.getRequest().getDependencyNode(); // SHRINKRES-143 lets ignore invalid scope ScopeType scopeType = ScopeType.RUNTIME; try { scopeType = ScopeType.fromScopeType(root.getDependency().getScope()); } catch (IllegalArgumentException e) { // let scope be RUNTIME log.log(Level.WARNING, "Invalid scope {0} of retrieved dependency {1} will be replaced by <scope>runtime</scope>", new Object[] { root.getDependency().getScope(), root.getDependency().getArtifact() }); } final List<DependencyNode> children = root.getChildren(); final boolean optional = root.getDependency().isOptional(); return new MavenResolvedArtifactImpl(artifact, scopeType, children, optional); }