-
Notifications
You must be signed in to change notification settings - Fork 354
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
AddParentPom
recipe
#4289
AddParentPom
recipe
#4289
Conversation
Great start @rcsilva83 ! Thanks for kicking this off. I've pushed a change to your PR to get the tests running. You had overridden |
rewrite-maven/src/main/java/org/openrewrite/maven/AddParentPom.java
Outdated
Show resolved
Hide resolved
Tests fail with "Recipe was expected to make a change but made no changes."
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
<parent> should come right after <modelVersion>
748e3ee
to
fb121e8
Compare
Hi @timtebeek ! Thank you very much for your help. The recipe is almost done: it's working but I still need to handle new parent's properties and dependency management. However, I have some doubts:
Regards! |
Actually, do you think is there anything to do on this regard? I though I needed to remove properties and dependency management declarations from the pom.xml if they exist on the new parent pom but I don't think that's the case. The If you can confirm this to me, I'll remove some unused code from the recipe and, after you feedback on the 2 questions I made before, it will be done. |
Thanks a lot @rcsilva83 ! To answer your questions I'll reply to each in a separate paragraph below. In ChangeParentPom we seem to skip with no changes when no acceptable version is found. Probably best to be consistent then, even if it could make for a frustrating debugging experience when there are misconfigurations. I wouldn't skip over validating the parent; we'd like to be sure the parent exists, since we'll use it to update the model of the code, and might otherwise lead to invalid configuration. As for updating properties: I'd maybe only go as far as doing a Is there anything else you'd then still like to push before a review and merge? |
I'll adjust this and make a new push. Then I think it'll be ready for merge :) |
@timtebeek I need your help on a new problem. After changing the change to make no changes when no suitable version is found, I still got an empty Everything is fine but apparently the How can I solve this? I couldn't find any situation like this in other recipes. |
All tests seem to pass; are we missing anything? Wondering because of your question above and the draft status. Ideally we have a failing test if there's anything to add still. We're planning a new release tomorrow; let me know if this should make it in in the current form, or with small changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial feedback already, with a few questions that might lead to stripping out some functionality still.
rewrite-maven/src/main/java/org/openrewrite/maven/AddParentPom.java
Outdated
Show resolved
Hide resolved
rewrite-maven/src/main/java/org/openrewrite/maven/AddParentPom.java
Outdated
Show resolved
Hide resolved
rewrite-maven/src/test/java/org/openrewrite/maven/AddParentPomTest.java
Outdated
Show resolved
Hide resolved
They are failing
Hi @timtebeek ! I'll take a look on you feedback and make the code changes needed. But I committed the failing tests I told before so you can understand the problem. I just solve them moving the code to |
…n version is invalid Now `RemoveRedundantDependencyVersions` doesn't work...
Co-authored-by: Tim te Beek <timtebeek@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work here @rcsilva83 ! The reason RemoveRedundantDependencyVersions
stopped working is because you had removed the call to maybeUpdateModel()
. That ensures our model is aware of the Maven parent before we make subsequent changes.
I've applied a few more polishing commits, and with those I think we're ready to merge. Thanks again!
@timtebeek, and I thank you for the guidance and patience! Now I know why OpenRewrite is improving so fast and have such a vibrant community :) Regards! |
Thank you! Couldn't do it without so many folks pitching in. You're changes have already landed in |
Tests fail with "Recipe was expected to make a change but made no changes."
What's changed?
A new AddParentPom recipe is added.
What's your motivation?
I need to add a parent POM to my projects.
Anything in particular you'd like reviewers to focus on?
Discover why is the recipe making no changes (as stated by the tests) and how to better share code with ChangeParentPom recipe.
Anyone you would like to review specifically?
@timtebeek (as he invited me to make a draft PR on #4239)
Have you considered any alternatives or workarounds?
Any additional context
Checklist