-
Notifications
You must be signed in to change notification settings - Fork 77
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
Disable value property resolution in org.openrewrite.maven.AddProperty
#707
Comments
org.openrewrite.maven.AddProperty
Yes seems reasonable; would you be willing to help look into this? Even if it's just adding a test at first, that's already helpful. From there we can then look through what's needed to make it pass. For now I'm doubting between if we should resolve variables at all, or if we need to offer a means to escape property resolve. |
On second thought, I don't think it's the Looks like the rewrite-maven-plugin resolves the property when it loads the recipe yaml file: rewrite-maven-plugin/src/main/java/org/openrewrite/maven/AbstractRewriteMojo.java Lines 121 to 142 in cbba2d4
|
We have issues with this using
Will explicitly set the version to the resolved value (if already existing) instead of using |
hi! Yes understand the use case; it's just that up to now that had been added quite deliberately. We could maybe disable it with a toggle, as I'm not seeing any option to escape replacements in the PropertyPlaceholderHelper as used from YamlResourceLoader. |
Figured push up a quick PR; if either of you could try that out and let me know your thoughts that'd be appreciated |
@jpraet / @der-eismann did either of you try out the latest snapshot already? Just to be sure this matches what you'd hoped for. |
Hey @timtebeek, I can confirm it's working fine for me. Thanks for the quick action!
After calling it with
Side note: The docs for the snapshots are slightly wrong:
The snapshot version would be |
Thanks! Fixed just now openrewrite/rewrite-docs@3b85d0c ; we have some imperfect automations to change version numbers across the docs; this was inadvertently changed in a recent update of the docs: /cc @mike-solomon
There will indeed never be a |
There are some though, but that's too offtopic here. Thanks for fixing the docs! |
Ah yes the Maven plugin is a slightly special case, as that doesn't use our typical Gradle plugins. For this project it can indeed happen that we do a .patch release when the releaser feels like it (usually me 👋🏻 ). In general though, we still use the Maven release plugin, which in our case also bumps to the next minor release version, as for instance seen in this automated commit: |
Unfortunately, I would need some more targeted mechanism (like an escape character) to exclude only certain properties from being resolved. |
Open to any proposals you might have; it's easier to review a concrete PR if you feel this would be helpful. |
What problem are you trying to solve?
With this recipe
I'm trying to add
<java_home>${java_home.jdk21}</java_home>
to the properties in the pom.xml.Where the <java_home.jdk21> property is defined in the ~/.m2/settings.xml on the developer workstations.
(in my case C:\tools\redhat-jdk21, but this can be different for other devs, and on our build server).
Unfortunately the property is set with the resolved value to
<java_home>C:\tools\redhat-jdk21</java_home>
.Describe the solution you'd like
An option to escape / disable the maven property resolution.
The text was updated successfully, but these errors were encountered: