use of com.itemis.maven.aether.ArtifactCoordinates 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.aether.ArtifactCoordinates 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);
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class ReleaseMetadata method addVersionInfo.
private void addVersionInfo(Properties p) {
Map<ReleasePhase, ArtifactCoordinates> reactorCoordinates = getArtifactCoordinatesByPhase(this.project.getGroupId(), this.project.getArtifactId());
if (reactorCoordinates != null) {
ArtifactCoordinates preReleaseCoordinates = reactorCoordinates.get(ReleasePhase.PRE_RELEASE);
ArtifactCoordinates releaseCoordinates = reactorCoordinates.get(ReleasePhase.RELEASE);
ArtifactCoordinates postReleaseCoordinates = reactorCoordinates.get(ReleasePhase.POST_RELEASE);
if (preReleaseCoordinates != null) {
p.setProperty(PROPERTIES_KEY_VERSION_REACTOR_PRE_RELEASE, preReleaseCoordinates.getVersion());
}
if (releaseCoordinates != null) {
p.setProperty(PROPERTIES_KEY_VERSION_REACTOR_RELEASE, releaseCoordinates.getVersion());
}
if (postReleaseCoordinates != null) {
p.setProperty(PROPERTIES_KEY_VERSION_REACTOR_POST_RELEASE, postReleaseCoordinates.getVersion());
}
}
}
use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.
the class CalculateVersions method execute.
@Override
public void execute(ExecutionContext context) throws MojoExecutionException, MojoFailureException {
this.log.info("Calculating required versions for all modules.");
for (MavenProject project : this.reactorProjects) {
this.log.info("\tVersions of module " + ProjectToString.EXCLUDE_VERSION.apply(project) + ":");
ArtifactCoordinates preReleaseCoordinates = this.metadata.getArtifactCoordinatesByPhase(project.getGroupId(), project.getArtifactId()).get(ReleasePhase.PRE_RELEASE);
this.log.info("\t\t" + ReleasePhase.PRE_RELEASE + " = " + preReleaseCoordinates.getVersion());
Optional<Prompter> prompterToUse = this.settings.isInteractiveMode() ? Optional.of(this.prompter) : Optional.<Prompter>absent();
String releaseVersion = calculateReleaseVersion(project.getVersion(), prompterToUse);
ArtifactCoordinates releaseCoordinates = new ArtifactCoordinates(project.getGroupId(), project.getArtifactId(), releaseVersion, PomUtil.ARTIFACT_TYPE_POM);
this.metadata.addArtifactCoordinates(releaseCoordinates, ReleasePhase.RELEASE);
this.log.info("\t\t" + ReleasePhase.RELEASE + " = " + releaseVersion);
String nextDevVersion = calculateDevelopmentVersion(project.getVersion(), prompterToUse);
ArtifactCoordinates postReleaseCoordinates = new ArtifactCoordinates(project.getGroupId(), project.getArtifactId(), nextDevVersion, PomUtil.ARTIFACT_TYPE_POM);
this.metadata.addArtifactCoordinates(postReleaseCoordinates, ReleasePhase.POST_RELEASE);
this.log.info("\t\t" + ReleasePhase.POST_RELEASE + " = " + nextDevVersion);
}
}
Aggregations