-
Notifications
You must be signed in to change notification settings - Fork 352
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
Maven: openrewrite should support AddModule / RemoveModule #4759
Comments
hi @cunningt ! What kind of recipes are you looking to compose using any Add/RemoveModule recipes? By themselves any such Add/RemoveModule recipes are unlikely to produce anything that meaningfully works; those modules would need to be matched up with recipes to add/remove the associated pom files, as well as potentially other associated sources. The targeting for any such recipes would also have to be very specific, as you'd likely only want to add this to a root pom.xml, not any nested sub pom.xmls. Taking the above into account, those constraints then quickly morph into an imperative recipe that as a small part changes a pom.xml, in likely restricted cases, as opposed to something that can easily be composed in a declarative recipe and be of reusable value. Any details you can provide about your intended use would be helpful to shape any recipes to build, or perhaps nudge towards an imperative recipe for the specific use case you're after. |
Use case : applying frequent changes and enhancements downstream to a pom.xml file where the pom.xml file is quite volatile upstream. Managing the changes through a .patch file doesn't work well because of frequent and inevitable merge conflicts. rewrite provides 90% of what I'd need here. It can add properties, dependencies, plugins, and dependencyManagement entries without having to worry about merge conflicts. I know use as a patching tool isn't really the intended purpose of rewrite, but it can do it pretty well. Add/Remove modules would really be helpful in this - and I agree that by itself it wouldn't completely solve the issue, I still would need to copy the module directory - but I'd love it if rewrite could handle more of the pom.xml changes I'm trying to make and the ability to add/remove modules would help. |
Thanks for that added context! In this case I'd perhaps then still lean towards at least starting out those recipes outside openrewrite/rewrite, as any such recipes by themselves are not yet something anyone can run in isolation and expect to work well. The potential then to have to field support questions on a recipe that requires knowledge of what it can and can't do is not ideal. Do you already have a place for any such custom recipes? I know colleagues of yours for instance maintain apache/camel-upgrade-recipes separately. |
What problem are you trying to solve?
OpenRewrite has recipes that add and remove plugins / dependencies / etc. Openrewrite should also be able to add or remove a
<module/>
to a pom's<modules/>
What precondition(s) should be checked before applying this recipe?
Describe the situation before applying the recipe
For AddModule - the situation before applying the recipe might be
Describe the situation after applying the recipe
For AddModule - the situation after applying the recipe to add a "bar" module would be
Have you considered any alternatives or workarounds?
Any additional context
Are you interested in contributing this recipe to OpenRewrite?
The text was updated successfully, but these errors were encountered: