-
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
Incompatibility with Maven Polyglot leads to ParseError
#649
Comments
Hi @laeubi ; Sorry to hear you're having these issues! I'm looking at these now and can at least confirm your issue; to replicate I've created a mvn -U org.openrewrite.maven:rewrite-maven-plugin:5.10.0:run \
-DactiveRecipes=org.eclipse.ui.PlatformUISetHelp -X | grep -v DEBUG It's a convenient shorthand instead of updating the |
Using the above I get the following rough output:
|
Thanks for the hint, I didn't find that in the documentation, maybe its worth to add it here: because it suggest adding it to the pom :-) |
Ah yes; we don't add that shorthand to every guide; we do add it to the individual recipe pages, such that it should be easy to find when you explore recipes. Just before the above exception I also see
|
Looks like the Maven parser has an issue with there not being a Maven project in For the Moderne platform I'd first need to ingest those projects before I can make them available; the Moderne CLI you can already download and try on your own machine. |
@timtebeek just in case you want to improve the plugin Its still strange that there is no error but these classcast exceptions. |
Never worked with those classes, and a bit unsure how to fit them in; would that help pick up a build file in We currently have Maven tell us which projects there are, but I guess that breaks down when running on a sub module folder. rewrite-maven-plugin/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java Lines 141 to 151 in ef0eb3a
Any suggestions for improvement welcome, always good to learn more and expand our coverage. For larger (and especially OSS) projects we do recommend the Moderne UI and CLI though, as that allows you to use pre-built models of your code, to speed things up and allow runs against large projects as a whole. |
I just guessing from the location of the exception mention In general polyglot works by choosing another file than the default
You find other "dialects" here: https://github.com/takari/polyglot-maven |
Thanks for background there on polyglot; I'd vaguely been aware of that up to now; hadn't encountered it yet, nor can I find how you're using it for that particular folder. We parse the Maven build files to resolve dependencies, such that we have all types available to attribute LST elements. We need those types for our matchers before we can do replacements; missing dependencies, and thus types, would result in changes not being applied where you would otherwise expect them. That's also why we recommend to run against the full project, rather than a sub module only, as there's likely inter module dependencies there. Running against the project as a whole might then also have Maven discover the projects that use polyglot, although that's merely my expectation, not something that I've tried. We'll see how the ingestion into app.moderne,io goes, and I'll keep you posted if you can do recipe runs there. |
Great, if you need any further information about polyglot let me know, Tycho makes heavy use of that an I currently try to get open-rewrite going in the Eclipse universe, in general you should get all dependencies from the |
@timtebeek I just found how Tycho loads the pom for modifications: to see if this is a generated pom (aka not modifiable) we check for the file to start with |
I have the same error even with moderne CLI
|
ParseError
Thanks both! I've renamed the issue to better match what's going on as we've learned more; If I understood correctly we can use the Once we parse those generated pom files we might incidentally also end up modifying them with recipes; not sure if that's an expected issue, but figured point it out just in case. |
Also came across this snippet in the MavenMojoProjectParser that might factor in here; although it was already in the version reported above: 12ff85a |
@timtebeek yes in the end there is a pom file generated, but in general you should not need to read the file directly as the modelreader can do so. What makes me wonder why not use the |
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a multi module project.
The project is hosted here:
https://github.com/eclipse-platform/eclipse.platform
What is the smallest, simplest way to reproduce the problem?
I added the above snippet to the root pom.xml
I created a rewrite.yml like this:
then I go to
debug/org.eclipse.debug.ui
in the project and callmvn rewrite:run
What is the full stack trace of any errors you encountered?
Are you interested in contributing a fix to OpenRewrite?
This might be because the project uses a polyglot build.
The text was updated successfully, but these errors were encountered: