You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/01/27 08:59:26 UTC
[maven-release] 01/01: Handle edge case for m-p-p
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch m-p-p-edge-case
in repository https://gitbox.apache.org/repos/asf/maven-release.git
commit 3e0d2bd658488ad00d50efc1644ba2eec46ca0f9
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Thu Jan 27 09:57:55 2022 +0100
Handle edge case for m-p-p
Seems m-release-p with all it's logic does not
cover an obvious edge case: to build a maven-plugin
(any, but think just about building m-p-p itself),
you MUST use other version (a released, other than current
project), that MAY be define as a property/inherited/etc.
---
.../release/phase/AbstractRewritePomsPhase.java | 40 +++++++++++++++++-----
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
index f9eba32..c5dea64 100644
--- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
+++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
@@ -27,6 +27,7 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Properties;
import java.util.TimeZone;
@@ -557,19 +558,42 @@ public abstract class AbstractRewritePomsPhase
}
else
{
- // the value of the expression conflicts with what the user wanted to release
- throw new ReleaseFailureException( "The artifact (" + key + ") requires a "
- + "different version (" + mappedVersion + ") than what is found ("
- + propertyValue + ") for the expression (" + expression + ") in the "
- + "project (" + projectId + ")." );
+ if ( Objects.equals( projectModel.getPackaging(), "maven-plugin" )
+ && "org.apache.maven.plugins:maven-plugin-plugin"
+ .equals( groupId + ":" + artifactId ) )
+ {
+
+ // edge case: to build a maven-plugin you MUST USE maven-plugin but
+ // with different version, that MAY be defined as a property
+ logInfo( result, " Ignoring artifact version update for maven-plugin-plugin" );
+ }
+ else
+ {
+ // the value of the expression conflicts with what the user wanted to release
+ throw new ReleaseFailureException( "The artifact (" + key + ") requires a "
+ + "different version (" + mappedVersion + ") than what is found ("
+ + propertyValue + ") for the expression (" + expression + ") in the "
+ + "project (" + projectId + ")." );
+ }
}
}
}
else
{
- // the expression used to define the version of this artifact may be inherited
- // TODO needs a better error message, what pom? what dependency?
- throw new ReleaseFailureException( "The version could not be updated: " + rawVersion );
+ if ( Objects.equals( projectModel.getPackaging(), "maven-plugin" )
+ && "org.apache.maven.plugins:maven-plugin-plugin"
+ .equals( groupId + ":" + artifactId ) )
+ {
+ // edge case: to build a maven-plugin you MUST USE maven-plugin but
+ // with different version, that MAY be defined as a property
+ logInfo( result, " Ignoring artifact version update for maven-plugin-plugin" );
+ }
+ else
+ {
+ // the expression used to define the version of this artifact may be inherited
+ // TODO needs a better error message, what pom? what dependency?
+ throw new ReleaseFailureException( "The version could not be updated: " + rawVersion );
+ }
}
}
}