[
https://issues.apache.org/jira/browse/MRELEASE-1154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17877026#comment-17877026
]
ASF GitHub Bot commented on MRELEASE-1154:
------------------------------------------
laeubi commented on code in PR #229:
URL: https://github.com/apache/maven-release/pull/229#discussion_r1732888258
##########
maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java:
##########
@@ -563,73 +521,61 @@ private void rewriteArtifactVersions(
if (rawVersion.equals(originalVersion)) {
logInfo(result, " Updating " + artifactId + " to " +
mappedVersion);
coordinate.setVersion(mappedVersion);
- } else {
- String property =
extractPropertyFromExpression(rawVersion);
- if (property != null) {
- if (property.startsWith("project.")
- || property.startsWith("pom.")
- || "version".equals(property)) {
- if
(!mappedVersion.equals(getNextVersion(releaseDescriptor, projectId))) {
- logInfo(result, " Updating " + artifactId + "
to " + mappedVersion);
- coordinate.setVersion(mappedVersion);
- } else {
- logInfo(result, " Ignoring artifact version
update for expression " + rawVersion);
- }
- } else if (properties != null) {
- // version is an expression, check for properties
to update instead
- String propertyValue =
properties.getProperty(property);
- if (propertyValue != null) {
- if (propertyValue.equals(originalVersion)) {
- logInfo(result, " Updating " + rawVersion
+ " to " + mappedVersion);
- // change the property only if the
property is the same as what's in the reactor
- properties.setProperty(property,
mappedVersion);
- } else if
(mappedVersion.equals(propertyValue)) {
- // this property may have been updated
during processing a sibling.
- logInfo(
- result,
- " Ignoring artifact version
update for expression " + rawVersion
- + " because it is already
updated");
- } else if (!mappedVersion.equals(rawVersion)) {
- // WARNING: ${pom.*} prefix support and
${version} is about to be dropped in mvn4!
- //
https://issues.apache.org/jira/browse/MNG-7404
- //
https://issues.apache.org/jira/browse/MNG-7244
- if
(mappedVersion.matches("\\$\\{project.+\\}")
- ||
mappedVersion.matches("\\$\\{pom.+\\}")
- ||
"${version}".equals(mappedVersion)) {
- logInfo(
- result,
- " Ignoring artifact version
update for expression " + mappedVersion);
- // ignore... we cannot update this
expression
- } 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 (" + rawVersion + ") in the "
- + "project (" + projectId +
").");
- }
- }
- } else {
- if (CI_FRIENDLY_PROPERTIES.contains(property))
{
Review Comment:
More than one property is supported here!
> [REGRESSION] MRELEASE-1109 breaks release of Maven Surefire
> -----------------------------------------------------------
>
> Key: MRELEASE-1154
> URL: https://issues.apache.org/jira/browse/MRELEASE-1154
> Project: Maven Release Plugin
> Issue Type: Bug
> Components: prepare
> Affects Versions: 3.1.0, 3.1.1
> Reporter: Michael Osipov
> Assignee: Michael Osipov
> Priority: Major
> Fix For: next-release
>
>
> Upgraded Maven Surefire to Parent 43 and failed to prepare release:
> {noformat}
> [INFO] Ignoring artifact version update for expression ${project.version}
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Reactor Summary for Apache Maven Surefire 3.5.1-SNAPSHOT:
> [INFO]
> [INFO] Apache Maven Surefire .............................. FAILURE [ 58.812
> s]
> [INFO] Surefire Shared Utils .............................. SKIPPED
> [INFO] Surefire Logger API ................................ SKIPPED
> [INFO] Surefire API ....................................... SKIPPED
> [INFO] Surefire Extensions API ............................ SKIPPED
> [INFO] Surefire Extensions SPI ............................ SKIPPED
> [INFO] Surefire Booter .................................... SKIPPED
> [INFO] Maven Surefire Test-Grouping Support ............... SKIPPED
> [INFO] Surefire Providers ................................. SKIPPED
> [INFO] Shared JUnit3 Provider Code ........................ SKIPPED
> [INFO] Shared Java 5 Provider Base ........................ SKIPPED
> [INFO] Shared JUnit4 Provider Code ........................ SKIPPED
> [INFO] Shared JUnit48 Provider Code ....................... SKIPPED
> [INFO] Surefire JUnit Runner .............................. SKIPPED
> [INFO] Surefire JUnit4 Runner ............................. SKIPPED
> [INFO] Maven Surefire Common .............................. SKIPPED
> [INFO] Surefire JUnitCore Runner .......................... SKIPPED
> [INFO] Surefire JUnit Platform Runner ..................... SKIPPED
> [INFO] Surefire TestNG Utils .............................. SKIPPED
> [INFO] Surefire TestNG Runner ............................. SKIPPED
> [INFO] ShadeFire JUnit3 Provider .......................... SKIPPED
> [INFO] Surefire Report Parser ............................. SKIPPED
> [INFO] Maven Surefire Plugin .............................. SKIPPED
> [INFO] Maven Failsafe Plugin .............................. SKIPPED
> [INFO] Maven Surefire Report Plugin ....................... SKIPPED
> [INFO] Maven Surefire Integration Tests ................... SKIPPED
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 01:02 min
> [INFO] Finished at: 2024-08-23T11:32:04+02:00
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-release-plugin:3.1.0:prepare (default-cli) on
> project surefire: Could not find properties resolving version expression :
> ${surefire-shared-utils.version} -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please
> read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
> {noformat}
> bisected down to:
> {noformat}
> osipovmi@deblndw011x:~/var/Projekte/maven-release ((9e0713b8...)|BISECTING)
> $ git bisect bad
> 9e0713b83d99723ebeb3e8347f3f69c69c585ed0 is the first bad commit
> commit 9e0713b83d99723ebeb3e8347f3f69c69c585ed0 (HEAD)
> Author: Konrad Windszus <[email protected]>
> Date: 2023-08-20T16:28:20+02:00
> [MRELEASE-1109] Support CI friendly versions (#198)
> .../maven/shared/release/phase/AbstractRewritePomsPhase.java | 150
> ++++++++++++++++++++----------
> .../apache/maven/shared/release/transform/jdom2/JDomModel.java | 17 +++-
> .../apache/maven/shared/release/transform/jdom2/JDomParent.java | 2 +-
> .../shared/release/phase/RewritePomsForReleasePhaseTest.java | 14 +++
> .../maven/shared/release/transform/jdom2/JDomModelTest.java | 9 +-
> .../maven/shared/release/transform/jdom2/JDomParentTest.java | 11 ++-
> .../pom-with-parent-and-cifriendly-expressions/expected-pom.xml | 39
> ++++++++
> .../pom-with-parent-and-cifriendly-expressions/pom.xml | 39
> ++++++++
> .../subproject1/expected-pom.xml | 28
> ++++++
> .../subproject1/pom.xml | 28
> ++++++
> 10 files changed, 282 insertions(+), 55 deletions(-)
> create mode 100644
> maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-cifriendly-expressions/expected-pom.xml
> create mode 100644
> maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-cifriendly-expressions/pom.xml
> create mode 100644
> maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-cifriendly-expressions/subproject1/expected-pom.xml
> create mode 100644
> maven-release-manager/src/test/resources/projects/rewrite-for-release/pom-with-parent-and-cifriendly-expressions/subproject1/pom.xml
> {noformat}
> Reverted the release locally on master and tried a snapshot. It does perform
> the dry run as expected. We either need to fix or revert the commit.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)