use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckPluginDependencyVersions method getSnapshotsFromManagement.
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(Profile profile, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking managed plugins of profile '" + profile.getId() + "'");
Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
BuildBase build = profile.getBuild();
if (build != null) {
PluginManagement pluginManagement = build.getPluginManagement();
if (pluginManagement != null) {
for (Plugin plugin : pluginManagement.getPlugins()) {
Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(), new IsSnapshotDependency(propertyResolver));
if (!snapshots.isEmpty()) {
result.putAll(PluginToCoordinates.INSTANCE.apply(plugin), Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}
}
}
}
return result;
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckPluginDependencyVersions method getSnapshotsFromManagement.
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromManagement(MavenProject project, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking managed plugins");
Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
Build build = project.getBuild();
if (build != null) {
PluginManagement pluginManagement = build.getPluginManagement();
if (pluginManagement != null) {
for (Plugin plugin : pluginManagement.getPlugins()) {
Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(), new IsSnapshotDependency(propertyResolver));
if (!snapshots.isEmpty()) {
result.putAll(PluginToCoordinates.INSTANCE.apply(plugin), Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}
}
}
}
return result;
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckPluginDependencyVersions method getSnapshots.
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshots(Profile profile, PomPropertyResolver propertyResolver) {
this.log.debug("\t\tChecking direct plugin references of profile '" + profile.getId() + "'");
Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
BuildBase build = profile.getBuild();
if (build != null) {
for (Plugin plugin : build.getPlugins()) {
Collection<Dependency> snapshots = Collections2.filter(plugin.getDependencies(), new IsSnapshotDependency(propertyResolver));
if (!snapshots.isEmpty()) {
result.putAll(PluginToCoordinates.INSTANCE.apply(plugin), Collections2.transform(snapshots, DependencyToCoordinates.INSTANCE));
}
}
}
return result;
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckPluginDependencyVersions method failIfSnapshotsAreReferenced.
private void failIfSnapshotsAreReferenced(boolean hasSnapshots, Map<MavenProject, Multimap<ArtifactCoordinates, ArtifactCoordinates>> snapshotsByProjectAndPlugin, Map<MavenProject, PomPropertyResolver> propertyResolvers) throws MojoFailureException {
if (hasSnapshots) {
this.log.error("\tThere are plugins with SNAPSHOT dependencies! The following list contains all SNAPSHOT dependencies grouped by plugin and module:");
for (MavenProject p : snapshotsByProjectAndPlugin.keySet()) {
PomPropertyResolver propertyResolver = propertyResolvers.get(p);
Multimap<ArtifactCoordinates, ArtifactCoordinates> snapshots = snapshotsByProjectAndPlugin.get(p);
if (!snapshots.isEmpty()) {
this.log.error("\t\t[PROJECT] " + ProjectToString.INSTANCE.apply(p));
for (ArtifactCoordinates plugin : snapshots.keySet()) {
this.log.error("\t\t\t[PLUGIN] " + plugin);
for (ArtifactCoordinates dependency : snapshots.get(plugin)) {
String resolvedVersion = propertyResolver.expandPropertyReferences(dependency.getVersion());
String coordinates = dependency.toString();
if (!Objects.equal(resolvedVersion, dependency.getVersion())) {
coordinates = coordinates + " (resolves to " + resolvedVersion + ")";
}
this.log.error("\t\t\t\t[DEPENDENCY] " + coordinates);
}
}
}
}
throw new MojoFailureException("The project cannot be released due to one or more SNAPSHOT plugin-dependencies!");
}
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CheckPluginDependencyVersions method getSnapshotsFromAllProfiles.
// IDEA implement to use active profiles only (maybe create the effective pom using api with the release profiles)
private Multimap<ArtifactCoordinates, ArtifactCoordinates> getSnapshotsFromAllProfiles(MavenProject project, PomPropertyResolver propertyResolver) {
Multimap<ArtifactCoordinates, ArtifactCoordinates> result = HashMultimap.create();
List<Profile> profiles = project.getModel().getProfiles();
if (profiles != null) {
for (Profile profile : profiles) {
result.putAll(getSnapshotsFromManagement(profile, propertyResolver));
result.putAll(getSnapshots(profile, propertyResolver));
}
}
return result;
}
Aggregations