-
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
Rewrite sources added through build-helper-maven-plugin
#755
Comments
Thanks for logging an issue @Rapster ! We'd up to now been tracking this internally, but good to have a public facing counterpart as well for the wider community to see, track progress and potentially help out. I haven't looked at the specifics yet, but it's likely to involve changes to our MavenMojoProjectParser, likely around here. rewrite-maven-plugin/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java Lines 182 to 183 in 41fa9a2
You'll notice we have access to both a Any help appreciated! |
To realize what I want to do here, I need the goal to be executed in |
Not sure if that's feasible as a single build step, as indeed we tie to rewrite-maven-plugin/src/main/java/org/openrewrite/maven/RewriteRunMojo.java Lines 29 to 32 in 41fa9a2
Would having to run multiple commands rule out your use case? |
I guess it should be fine, depends what those steps would be. But maybe instead of relying on maven, I could do it programmatically (using rewrite API) but can't find much doc there. Any idea? |
Using just the recipes as an API isn't recommended in most cases, as that might then fail to set up the class path correctly, miss markers, cycles and other complications. For that reason we removed the doc , as some folks went down that path and ran into issues. The historic page is still available in the history though; it's just not been kept up to date with the move to rewrite v8. Your use case seems limited enough where it could be an option; you might want to look at how the OSS plugins run recipes as an example. |
Thank you @timtebeek I'll definitely give it a try |
build-helper-maven-plugin
This issue came up again both on StackOverflow and in our Slack: https://stackoverflow.com/questions/78493917/openrewrite-is-not-visiting-files-from-src-integration-tests-java-directory?noredirect=1#comment138383161_78493917 In short the recommended approach is not to use separate source sets for integration tests where possible, but to instead use a naming convention where the Maven surefire plugin then runs any unit tests named Any other uses of build-helper-maven-plugin could still benefit from an addition to the rewrite-maven-plugin that parses those additional source sets. |
Based on https://stackoverflow.com/q/77927116/4605161
What problem are you trying to solve?
In our codebase, we had to copy an entire class by hand just because some methods are private. So instead of being able to overwrite a few methods, we end up maintining a class of thousands LOC.
Describe the solution you'd like
After copying the entire source code with
build-helper-plugin
, I'd love to apply a few transformations with recipes (essentially private to protected). Execute the recipe maven plugin in process-sources phase to execute a recipeHave you considered any alternatives or workarounds?
Spoon
Additional context
Are you interested in contributing this feature to OpenRewrite?
The text was updated successfully, but these errors were encountered: