@Override public boolean accept(Dependency dependency) { return dependency != null && !dependency.getCoordinate().isSnapshot(); } }
/** * Compare the {@link Coordinate} of each given {@link Dependency} for equivalence. */ public static boolean areEquivalent(Dependency l, Dependency r) { if (l == r) { return true; } if ((l == null) && (r == null)) { return true; } else if ((l == null) || (r == null)) { return false; } return !(l.getCoordinate().getArtifactId() != null ? !l.getCoordinate().getArtifactId() .equals(r.getCoordinate().getArtifactId()) : r.getCoordinate().getArtifactId() != null) && !(l.getCoordinate().getGroupId() != null ? !l.getCoordinate().getGroupId() .equals(r.getCoordinate().getGroupId()) : r.getCoordinate().getGroupId() != null) && !(l.getCoordinate().getClassifier() != null ? !l.getCoordinate().getClassifier() .equals(r.getCoordinate().getClassifier()) : r.getCoordinate().getClassifier() != null); } /**
public static DependencyBuilder create(final Dependency dep) { DependencyBuilder builder = new DependencyBuilder(); builder.setCoordinate(dep.getCoordinate()); builder.setScopeType(dep.getScopeType()); return builder; }
public MavenDependencyAdapter(final Dependency dep) { if (dep == null) { throw new IllegalArgumentException("Dependency must not be null."); } this.setArtifactId(dep.getCoordinate().getArtifactId()); this.setGroupId(dep.getCoordinate().getGroupId()); this.setVersion(dep.getCoordinate().getVersion()); this.setScope(dep.getScopeType()); this.setType(dep.getCoordinate().getPackaging()); this.setClassifier(dep.getCoordinate().getClassifier()); this.setSystemPath(dep.getCoordinate().getSystemPath()); if (dep.getExcludedCoordinates() != null) { for (Coordinate exclusion : dep.getExcludedCoordinates()) { Exclusion temp = new Exclusion(); temp.setArtifactId(exclusion.getArtifactId()); temp.setGroupId(exclusion.getGroupId()); this.getExclusions().add(temp); } } }
if (!Strings.isNullOrEmpty(existing.getCoordinate().getVersion()) && (existing.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion()) || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))) if (!Strings.isNullOrEmpty(existingManaged.getCoordinate().getVersion()) && (existingManaged.getCoordinate().getVersion().equals(dependency.getCoordinate().getVersion()) || Strings.isNullOrEmpty(dependency.getCoordinate().getVersion()))) if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())) dependency.getCoordinate()).setFilter(new NonSnapshotDependencyFilter())); dependency.getCoordinate())); + dependency.getCoordinate() + "].");
@Override public Dependency installManaged(Project project, Dependency dependency) { DependencyFacet deps = project.getFacet(DependencyFacet.class); if (Strings.isNullOrEmpty(dependency.getCoordinate().getVersion())) { // we didn't request a specific version updateManagedDependency(deps, dependency); } else { // we requested a specific version updateManagedDependency(deps, dependency); } return dependency; }