Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing a tag into a variable-containing-one replaces it with the value at run time #4840

Open
svaningelgem opened this issue Jan 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@svaningelgem
Copy link
Contributor

What version of OpenRewrite are you using?

I am using

  • OpenRewrite master branch

How are you running OpenRewrite?

mvn rewrite:run

What is the smallest, simplest way to reproduce the problem?

  - org.openrewrite.xml.AddOrUpdateChildTag:
      parentXPath: //dependency[groupId="com.example.ws4"]
      newChildTag: "<groupId>${some.variable}</groupId>"

What did you expect to see?

That the groupId would be replaced by ${some.variable}.

What did you see instead?

That the groupId was replaced by com.example.ws4.

[WARNING] Changes have been made to war\pom.xml by:
[WARNING]                 org.openrewrite.xml.AddOrUpdateChildTag: {parentXPath=//dependency[groupId="com.example.ws4"], newChildTag=<groupId>com.example.ws4</groupId>}
@svaningelgem svaningelgem added the bug Something isn't working label Jan 3, 2025
@svaningelgem
Copy link
Contributor Author

FYI, this works though:

  - org.openrewrite.xml.ChangeTagValue:
      elementName: //dependency/groupId
      oldValue: "^com\\.example\\.ws.$"
      newValue: "\\$\\{some.variable}"
      regex: true

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
Status: No status
Development

No branches or pull requests

1 participant