private static String toCapsuleExclusionsString(Collection<Exclusion> exclusions) { final StringBuilder res = new StringBuilder(); if (!exclusions.isEmpty()) { res.append("("); boolean starting = true; for (Exclusion e : exclusions) { if (!starting) res.append(","); else starting = false; res.append(e.getGroupId()); res.append(":"); if (e.getArtifactId() != null && e.getArtifactId().length() > 0) res.append(e.getArtifactId()); else res.append("*"); } res.append(")"); } return res.toString(); } }
/** * Exclusive can be specified by wildcard: * -- groupId:artifactId:*:* * -- groupId:*:*:* * <p> * And in general, to require a strict match up to the version and the classifier is not necessary * <p> * TODO: the correct fix would be to rewrite {@link Exclusion # equals (Object)}, but what about the boundary case: * If contains (id1: *: *: *, id1: id2: *: *) == true, then that's equals ?? * TODO: there must be useful code in Aether or maven on this topic * <p> * @param exclusions * @param exclusion * @return */ private boolean containsEx(Collection<Exclusion> exclusions, Exclusion exclusion){ if(exclusion != null && exclusions != null) { for(Exclusion currentExclusion: exclusions){ if (currentExclusion.getGroupId().equals(exclusion.getGroupId()) && (currentExclusion.getArtifactId().equals(exclusion.getArtifactId()) || (currentExclusion.getArtifactId().equals(ARTIFACT_STAR)))) { return true; } } } return false; }
public static MavenDependencyExclusion fromExclusion(final Exclusion exclusion) { final MavenDependencyExclusion translated = MavenDependencies.createExclusion(exclusion.getGroupId(), exclusion.getArtifactId()); return translated; }
public static MavenDependencyExclusion fromExclusion(final Exclusion exclusion) { final MavenDependencyExclusion translated = MavenDependencies.createExclusion(exclusion.getGroupId(), exclusion.getArtifactId()); return translated; }
@Override public String toString() { return getGroupId() + ':' + getArtifactId() + ':' + getExtension() + ( getClassifier().length() > 0 ? ':' + getClassifier() : "" ); }
@Override public String toString() { return getGroupId() + ':' + getArtifactId() + ':' + getExtension() + ( getClassifier().length() > 0 ? ':' + getClassifier() : "" ); }
public int compare( Exclusion e1, Exclusion e2 ) { if ( e1 == null ) { return ( e2 == null ) ? 0 : 1; } else if ( e2 == null ) { return -1; } int rel = e1.getArtifactId().compareTo( e2.getArtifactId() ); if ( rel == 0 ) { rel = e1.getGroupId().compareTo( e2.getGroupId() ); if ( rel == 0 ) { rel = e1.getExtension().compareTo( e2.getExtension() ); if ( rel == 0 ) { rel = e1.getClassifier().compareTo( e2.getClassifier() ); } } } return rel; }
public int compare( Exclusion e1, Exclusion e2 ) { if ( e1 == null ) { return ( e2 == null ) ? 0 : 1; } else if ( e2 == null ) { return -1; } int rel = e1.getArtifactId().compareTo( e2.getArtifactId() ); if ( rel == 0 ) { rel = e1.getGroupId().compareTo( e2.getGroupId() ); if ( rel == 0 ) { rel = e1.getExtension().compareTo( e2.getExtension() ); if ( rel == 0 ) { rel = e1.getClassifier().compareTo( e2.getClassifier() ); } } } return rel; }
private void setExclusions(final Collection<org.eclipse.aether.graph.Exclusion> exclusions) { List<Exclusion> result = new ArrayList<>(); for (org.eclipse.aether.graph.Exclusion exclusion : exclusions) { Exclusion temp = new Exclusion(); temp.setArtifactId(exclusion.getArtifactId()); temp.setGroupId(exclusion.getGroupId()); result.add(temp); } super.setExclusions(result); }
private boolean isExcludedFromParent(Dependency dependency) { boolean result = false; if (parent != null && parent.getExclusions().size() > 0) { for (Exclusion exclusion : parent.getExclusions()) { if (exclusion != null) { if (exclusion.getArtifactId() != null && exclusion.getArtifactId().equals(dependency.getArtifact().getArtifactId())) { if (exclusion.getGroupId() != null && exclusion.getGroupId().equals(dependency.getArtifact().getGroupId())) { result = true; break; } } } } } return result; }
private boolean isExcludedFromParent(Dependency dependency) { boolean result = false; if (parent != null && parent.getExclusions().size() > 0) { for (Exclusion exclusion : parent.getExclusions()) { if (exclusion != null) { if (exclusion.getArtifactId() != null && exclusion.getArtifactId().equals(dependency.getArtifact().getArtifactId())) { if (exclusion.getGroupId() != null && exclusion.getGroupId().equals(dependency.getArtifact().getGroupId())) { result = true; break; } } } } } return result; }
private boolean isExcludedFromParent(Dependency dependency) { boolean result = false; if (parent != null && parent.getExclusions().size() > 0) { for (Exclusion exclusion : parent.getExclusions()) { if (exclusion != null) { if (exclusion.getArtifactId() != null && exclusion.getArtifactId().equals(dependency.getArtifact().getArtifactId())) { if (exclusion.getGroupId() != null && exclusion.getGroupId().equals(dependency.getArtifact().getGroupId())) { result = true; break; } } } } } return result; }
if (e.getArtifactId().equals(dependencyNode.getArtifact().getArtifactId()) && e.getGroupId().equals(dependencyNode.getArtifact().getGroupId())) { return false; if (e.getArtifactId().equals(parent.getArtifact().getArtifactId()) && e.getGroupId().equals(parent.getArtifact().getGroupId())) { return false;
(currentExclusion.getArtifactId().equals(artifact.getArtifactId())) || (currentExclusion.getArtifactId().equals(ARTIFACT_STAR))){ getLog().debug("Filtering excluded dependency "+dependencyNode.getDependency()); return false;
private Dependency toMavenDependency(org.eclipse.aether.graph.Dependency from) { org.eclipse.aether.artifact.Artifact fromArt = from.getArtifact(); Dependency dependency = new Dependency(); dependency.setGroupId(fromArt.getGroupId()); dependency.setArtifactId(fromArt.getArtifactId()); dependency.setVersion(fromArt.getVersion()); dependency.setType(fromArt.getExtension()); dependency.setScope(Artifact.SCOPE_COMPILE.equals(from.getScope()) ? null : from.getScope()); dependency.setClassifier(fromArt.getClassifier()); dependency.setOptional(dependency.isOptional()); if (from.getExclusions() != null && from.getExclusions().size() > 0) { List<Exclusion> exclusions = new LinkedList<Exclusion>(); for (org.eclipse.aether.graph.Exclusion fromEx : from.getExclusions()) { Exclusion ex = new Exclusion(); ex.setGroupId(fromEx.getGroupId()); ex.setArtifactId(fromEx.getArtifactId()); exclusions.add(ex); } dependency.setExclusions(exclusions); } return dependency; }
private boolean matches( Exclusion exclusion, Artifact artifact ) { if ( !matches( exclusion.getArtifactId(), artifact.getArtifactId() ) ) { return false; } if ( !matches( exclusion.getGroupId(), artifact.getGroupId() ) ) { return false; } if ( !matches( exclusion.getExtension(), artifact.getExtension() ) ) { return false; } if ( !matches( exclusion.getClassifier(), artifact.getClassifier() ) ) { return false; } return true; }
private boolean matches( Exclusion exclusion, Artifact artifact ) { if ( !matches( exclusion.getArtifactId(), artifact.getArtifactId() ) ) { return false; } if ( !matches( exclusion.getGroupId(), artifact.getGroupId() ) ) { return false; } if ( !matches( exclusion.getExtension(), artifact.getExtension() ) ) { return false; } if ( !matches( exclusion.getClassifier(), artifact.getClassifier() ) ) { return false; } return true; }