Skip to content

Add literal replacement support to regex property goals - #249

Merged
slachiewicz merged 2 commits into
mojohaus:masterfrom
wilx:issue-155-replacement-literal
Nov 1, 2026
Merged

slachiewicz merged 2 commits into
mojohaus:masterfrom
wilx:issue-155-replacement-literal

Conversation

@wilx

@wilx wilx commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Regex replacements currently interpret backslashes and dollar signs in interpolated values, corrupting Windows paths and other literal strings. Add an opt-in replacementLiteral parameter to regex-property and each regex-properties setting. When enabled, the plugin applies Matcher.quoteReplacement() before replacing matches. The default remains false, preserving existing replacement syntax and regex matching behavior.

Document the option with a Windows-path example using \A.*\z to replace the input once. Add unit and integration coverage for literal backslashes and dollar signs, null and empty replacements, multiple matches, and existing group substitution.

Fixes #155

Validation checklist:

  • Confirmed the new integration regression fails against the original implementation.
  • Added and passed regression coverage for both regex-property and regex-properties.
  • Applied Spotless formatting and passed git diff --check.
  • Passed all 69 unit tests and all 6 regex integration tests with mvn -Dspotless.action=check -Prun-its '-Dinvoker.test=regex-*' -Dinvoker.rerunFailingTestsCount=0 clean verify.
  • Documented the parameter and its default, including @since 3.6.2.
  • Built the documentation with mvn -DskipReports site and verified that the rendered example preserves the regex backslashes and ${project.build.directory} expression.

Local validation used Linux, Maven 3.9.16, and Eclipse Adoptium Java 26.0.2.

@slachiewicz slachiewicz added the bug Something isn't working label Sep 11, 2026
@slachiewicz
slachiewicz merged commit 7690ae3 into mojohaus:master Nov 1, 2026
12 checks passed
@github-actions github-actions Bot added this to the 3.6.3 milestone Nov 1, 2026
@wilx
wilx deleted the issue-155-replacement-literal branch November 1, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regex-property goal doesn't interpret <replacement> correctly, corrupting output

2 participants