@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; }
static Artifact coordinateToMavenArtifact(final Coordinate dep) { Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getClassifier(), dep.getPackaging() == null ? "jar" : dep.getPackaging(), dep.getVersion()); return artifact; }
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())) versions.get(versions.size() - 1).getVersion()); else
try String version = dep.getVersion(); if (version == null || version.isEmpty())
public static CoordinateBuilder create(Coordinate c) { CoordinateBuilder builder = create(); builder.setGroupId(c.getGroupId()).setArtifactId(c.getArtifactId()); builder.setClassifier(c.getClassifier()).setPackaging(c.getPackaging()).setVersion(c.getVersion()); 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); } } }