use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckAether method resolve.
private Optional<ResolutionResult> resolve(String groupId, String artifactId, String version, boolean remoteOnly) {
ArtifactCoordinates coordinates = new ArtifactCoordinates(groupId, artifactId, version, PomUtil.ARTIFACT_TYPE_POM);
Optional<ResolutionResult> result = this.artifactResolver.resolve(coordinates, remoteOnly);
return result;
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckDependencyVersions method getSnapshotsFromManagement.
private Set<ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking managed dependencies");
DependencyManagement dependencyManagement = project.getDependencyManagement();
if (dependencyManagement != null) {
Collection<Dependency> snapshots = Collections2.filter(dependencyManagement.getDependencies(), new IsSnapshotDependency(propertyResolver));
HashSet<ArtifactCoordinates> snapshotDependencies = Sets.newHashSet(Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
filterMultiModuleDependencies(snapshotDependencies);
return snapshotDependencies;
}
return Collections.emptySet();
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckDependencyVersions method getSnapshotsFromAllProfiles.
private Set<ArtifactCoordinates> getSnapshotsFromAllProfiles(MavenProject project, PomPropertyResolver propertyResolver) {
Set<ArtifactCoordinates> snapshots = Sets.newHashSet();
List<Profile> profiles = project.getModel().getProfiles();
if (profiles != null) {
for (Profile profile : profiles) {
snapshots.addAll(getSnapshotsFromManagement(profile, propertyResolver));
snapshots.addAll(getSnapshots(profile, propertyResolver));
}
}
filterMultiModuleDependencies(snapshots);
return snapshots;
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckDependencyVersions method getSnapshots.
private Set<ArtifactCoordinates> getSnapshots(MavenProject project, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking direct dependencies");
Collection<Dependency> snapshots = Collections2.filter(project.getDependencies(), new IsSnapshotDependency(propertyResolver));
HashSet<ArtifactCoordinates> snapshotDependencies = Sets.newHashSet(Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
filterMultiModuleDependencies(snapshotDependencies);
return snapshotDependencies;
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckParentVersions method execute.
@Override
public void execute(ExecutionContext context) throws MojoExecutionException, MojoFailureException {
this.log.info("Checking that the project modules do not reference SNAPSHOT parents that are not scheduled for release.");
Map<String, String> snapshotParentReferences = Maps.newHashMap();
for (MavenProject p : this.reactorProjects) {
MavenProject parent = p.getParent();
if (parent != null && IsSnapshotProject.INSTANCE.apply(parent)) {
Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(parent.getGroupId(), parent.getArtifactId());
ArtifactCoordinates coordinates = coordinatesByPhase.get(ReleasePhase.PRE_RELEASE);
if (coordinates != null && Objects.equal(parent.getVersion(), coordinates.getVersion())) {
this.log.debug("\tModule '" + ProjectToString.INSTANCE.apply(p) + "' references SNAPSHOT parent '" + ProjectToString.INSTANCE.apply(parent) + "' which is also scheduled for release.");
} else {
snapshotParentReferences.put(ProjectToString.INSTANCE.apply(p), ProjectToString.INSTANCE.apply(parent));
}
}
}
if (!snapshotParentReferences.isEmpty()) {
this.log.error("\tThe following modules have references to SNAPSHOT parents that are not scheduled for release:");
for (String projectCoordinates : snapshotParentReferences.keySet()) {
this.log.error("\t\t" + projectCoordinates + " => " + snapshotParentReferences.get(projectCoordinates));
}
throw new MojoFailureException("There are modules that reference SNAPSHOT parents which are not scheduled for release!");
}
}
Aggregations