Skip to content

Commit

Permalink
MRELEASE-1109 patch JDomModel (#201)
Browse files Browse the repository at this point in the history
Co-authored-by: Mikhail Kolesnikov <[email protected]>
  • Loading branch information
mkolesnikov and Mikhail Kolesnikov authored Jan 10, 2024
1 parent 0a8ed0f commit 8dfcb47
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public abstract class AbstractRewritePomsPhase extends AbstractReleasePhase impl
* Regular expression pattern matching Maven expressions (i.e. references to Maven properties).
* The first group selects the property name the expression refers to.
*/
private static final Pattern EXPRESSION_PATTERN = Pattern.compile("\\$\\{(.+)\\}");
private static final Pattern EXPRESSION_PATTERN = Pattern.compile("\\$\\{(.+?)\\}");

/**
* All Maven properties allowed to be referenced in parent versions via expressions
Expand Down Expand Up @@ -462,7 +462,7 @@ private void rewriteVersion(
*/
public static String extractPropertyFromExpression(String expression) {
Matcher matcher = EXPRESSION_PATTERN.matcher(expression);
if (!matcher.matches()) {
if (!matcher.find()) {
return null;
}
return matcher.group(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void setVersion(String version) {
AbstractRewritePomsPhase.extractPropertyFromExpression(versionElement.getTextNormalize());
Properties properties = getProperties();
if (properties != null) {
properties.computeIfPresent(ciFriendlyPropertyName, (k, v) -> version);
properties.setProperty(ciFriendlyPropertyName, version);
}
} else {
JDomUtils.rewriteValue(versionElement, version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</scm>

<properties>
<revision>1.0-SNAPSHOT</revision>
<revision>1.0</revision>
</properties>

<modules>
Expand Down

0 comments on commit 8dfcb47

Please sign in to comment.