use of com.itemis.maven.plugins.unleash.util.PomPropertyResolver in project unleash-maven-plugin by shillner.
the class CheckPluginVersions method failIfSnapshotsAreReferenced.
private void failIfSnapshotsAreReferenced(Multimap<MavenProject, ArtifactCoordinates> snapshotsByProject, Map<MavenProject, PomPropertyResolver> propertyResolvers) throws MojoFailureException {
if (!snapshotsByProject.values().isEmpty()) {
this.log.error("\tThere are references to SNAPSHOT plugins! The following list contains all SNAPSHOT plugins grouped by module:");
for (MavenProject project : snapshotsByProject.keySet()) {
PomPropertyResolver propertyResolver = propertyResolvers.get(project);
Collection<ArtifactCoordinates> snapshots = snapshotsByProject.get(project);
if (!snapshots.isEmpty()) {
this.log.error("\t\t[PROJECT] " + ProjectToString.INSTANCE.apply(project));
for (ArtifactCoordinates plugin : snapshots) {
String resolvedVersion = propertyResolver.expandPropertyReferences(plugin.getVersion());
String coordinates = plugin.toString();
if (!Objects.equal(resolvedVersion, plugin.getVersion())) {
coordinates = coordinates + " (resolves to " + resolvedVersion + ")";
}
this.log.error("\t\t\t[PLUGIN] " + coordinates);
}
}
}
throw new MojoFailureException("The project cannot be released due to one or more SNAPSHOT plugins!");
}
}
use of com.itemis.maven.plugins.unleash.util.PomPropertyResolver in project unleash-maven-plugin by shillner.
the class CheckPluginVersions method execute.
@Override
public void execute(ExecutionContext context) throws MojoExecutionException, MojoFailureException {
this.log.info("Checking that none of the reactor projects contains SNAPSHOT plugins.");
Map<MavenProject, PomPropertyResolver> propertyResolvers = Maps.newHashMapWithExpectedSize(this.reactorProjects.size());
Multimap<MavenProject, ArtifactCoordinates> snapshotsByProject = HashMultimap.create();
for (MavenProject project : this.reactorProjects) {
this.log.debug("\tChecking plugins of reactor project '" + ProjectToString.INSTANCE.apply(project) + "':");
PomPropertyResolver propertyResolver = new PomPropertyResolver(project, this.settings, this.profiles, this.releaseArgs);
propertyResolvers.put(project, propertyResolver);
snapshotsByProject.putAll(project, getSnapshotsFromManagement(project, propertyResolver));
snapshotsByProject.putAll(project, getSnapshots(project, propertyResolver));
snapshotsByProject.putAll(project, getSnapshotsFromAllProfiles(project, propertyResolver));
removePluginForIntegrationTests(snapshotsByProject);
}
failIfSnapshotsAreReferenced(snapshotsByProject, propertyResolvers);
}
Aggregations