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!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]