Search in sources :

Example 11 with ArtifactCoordinates

use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.

the class DetectReleaseArtifacts method wasFixedVersion.

private boolean wasFixedVersion(MavenProject p) {
    Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(p.getGroupId(), p.getArtifactId());
    String preReleaseVersion = coordinatesByPhase.get(ReleasePhase.PRE_RELEASE).getVersion();
    String releaseVersion = coordinatesByPhase.get(ReleasePhase.RELEASE).getVersion();
    if (Objects.equal(preReleaseVersion, releaseVersion)) {
        return true;
    }
    return false;
}
Also used : ReleasePhase(com.itemis.maven.plugins.unleash.ReleasePhase) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates) ProjectToString(com.itemis.maven.plugins.unleash.util.functions.ProjectToString)

Example 12 with ArtifactCoordinates

use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.

the class SetNextDevVersion method setProjectVersion.

private void setProjectVersion(MavenProject project, Document document) {
    Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(project.getGroupId(), project.getArtifactId());
    String oldVerion = coordinatesByPhase.get(ReleasePhase.RELEASE).getVersion();
    String newVersion = coordinatesByPhase.get(ReleasePhase.POST_RELEASE).getVersion();
    this.log.debug("\t\tUpdate of module version '" + project.getGroupId() + ":" + project.getArtifact() + "' [" + oldVerion + " => " + newVersion + "] Version Upgrade Strategy: " + this.versionUpgradeStrategy.name());
    PomUtil.setProjectVersion(project.getModel(), document, newVersion);
}
Also used : ReleasePhase(com.itemis.maven.plugins.unleash.ReleasePhase) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates) ProjectToString(com.itemis.maven.plugins.unleash.util.functions.ProjectToString)

Example 13 with ArtifactCoordinates

use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.

the class SetNextDevVersion method setParentVersion.

private void setParentVersion(MavenProject project, Document document) {
    Parent parent = project.getModel().getParent();
    if (parent != null) {
        Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(parent.getGroupId(), parent.getArtifactId());
        ArtifactCoordinates oldCoordinates = coordinatesByPhase.get(ReleasePhase.RELEASE);
        ArtifactCoordinates newCoordinates = coordinatesByPhase.get(ReleasePhase.POST_RELEASE);
        // for it
        if (newCoordinates != null) {
            this.log.debug("\t\tUpdate of parent version of module '" + project.getGroupId() + ":" + project.getArtifact() + "' [" + oldCoordinates.getVersion() + " => " + newCoordinates.getVersion() + "]");
            PomUtil.setParentVersion(project.getModel(), document, newCoordinates.getVersion());
        }
    }
}
Also used : Parent(org.apache.maven.model.Parent) ReleasePhase(com.itemis.maven.plugins.unleash.ReleasePhase) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates)

Example 14 with ArtifactCoordinates

use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.

the class SetReleaseVersions method setParentVersion.

private void setParentVersion(MavenProject project, Document document) {
    Parent parent = project.getModel().getParent();
    if (parent != null) {
        Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(parent.getGroupId(), parent.getArtifactId());
        ArtifactCoordinates oldCoordinates = coordinatesByPhase.get(ReleasePhase.PRE_RELEASE);
        ArtifactCoordinates newCoordinates = coordinatesByPhase.get(ReleasePhase.RELEASE);
        // for it
        if (newCoordinates != null) {
            this.log.debug("\tUpdate of parent version of module '" + project.getGroupId() + ":" + project.getArtifact() + "' [" + oldCoordinates.getVersion() + " => " + newCoordinates.getVersion() + "]");
            PomUtil.setParentVersion(project.getModel(), document, newCoordinates.getVersion());
        }
    }
}
Also used : Parent(org.apache.maven.model.Parent) ReleasePhase(com.itemis.maven.plugins.unleash.ReleasePhase) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates)

Example 15 with ArtifactCoordinates

use of com.itemis.maven.aether.ArtifactCoordinates in project unleash-maven-plugin by shillner.

the class SetReleaseVersions method setProjectVersion.

private void setProjectVersion(MavenProject project, Document document) {
    Map<ReleasePhase, ArtifactCoordinates> coordinatesByPhase = this.metadata.getArtifactCoordinatesByPhase(project.getGroupId(), project.getArtifactId());
    String oldVerion = coordinatesByPhase.get(ReleasePhase.PRE_RELEASE).getVersion();
    String newVersion = coordinatesByPhase.get(ReleasePhase.RELEASE).getVersion();
    this.log.debug("\tUpdate of module version '" + project.getGroupId() + ":" + project.getArtifact() + "' [" + oldVerion + " => " + newVersion + "]");
    PomUtil.setProjectVersion(project.getModel(), document, newVersion);
}
Also used : ReleasePhase(com.itemis.maven.plugins.unleash.ReleasePhase) ArtifactCoordinates(com.itemis.maven.aether.ArtifactCoordinates) ProjectToString(com.itemis.maven.plugins.unleash.util.functions.ProjectToString)

Aggregations

ArtifactCoordinates (com.itemis.maven.aether.ArtifactCoordinates)29 ProjectToString (com.itemis.maven.plugins.unleash.util.functions.ProjectToString)12 MavenProject (org.apache.maven.project.MavenProject)11 ReleasePhase (com.itemis.maven.plugins.unleash.ReleasePhase)9 PomPropertyResolver (com.itemis.maven.plugins.unleash.util.PomPropertyResolver)6 IsSnapshotDependency (com.itemis.maven.plugins.unleash.util.predicates.IsSnapshotDependency)6 Dependency (org.apache.maven.model.Dependency)6 Plugin (org.apache.maven.model.Plugin)4 MojoFailureException (org.apache.maven.plugin.MojoFailureException)4 Profile (org.apache.maven.model.Profile)3 ResolutionResult (com.itemis.maven.aether.ArtifactResolver.ResolutionResult)2 IOException (java.io.IOException)2 Build (org.apache.maven.model.Build)2 BuildBase (org.apache.maven.model.BuildBase)2 Parent (org.apache.maven.model.Parent)2 PluginManagement (org.apache.maven.model.PluginManagement)2 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 VersionsEngine (org.eclipse.tycho.versions.engine.VersionsEngine)2 Document (org.w3c.dom.Document)2 HashMultimap (com.google.common.collect.HashMultimap)1