-
Notifications
You must be signed in to change notification settings - Fork 76
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
Unresolvable dependency leading to hard to debug issues #703
Comments
I had a similar issue. I have a set of recipes that includes a In my case, the issue was related to a custom Hope that helps. |
Thanks, that's interesting and I've been running some tests with settings this morning. No luck so far however. How did you find out that this was the problem, though? |
I was having inconsistent wall-clock run times for the same set of recipes, during the day and on different machines (ranging from 33s to 1h45m). You can add |
Alright, this is a little embarrassing but here we go. After tearing down my Maven settings, running the recipe locally and remotely many times, in Docker, etc. I ended up understanding that the main difference between my local env. and my CI is that… the target pom for this recipe was not published properly. Outside of this error on my end, I must say that I was quite misled by OpenRewrite. Now that I can come up with clear reproduction steps, I would like to submit an improvement. Should it be here or with OpenRewrite directly? |
Hi @maxime-michel ; thanks for wanting to improve the experience in the face of unexpected issues; what kind of change would you think would help here? I think we ought to have logged something already if a pom or jar failed to download, but can't determine that from the above. |
Hey @timtebeek, thanks for getting back to me. Fully agree with you, my last message wasn't clear. I wanted to come back to this issue but got caught up with other tasks. In any case, in my setup at least, the issue boils down to OpenRewrite not failing nor issuing a warning in the case where the dependency isn't available. I can reproduce the case fairly easily where the |
Indeed we still try to proceed when there's issues with the project setup, which might be uncommon, but allows us to support a wider range of projects and modernizations even in the light of perceived small issues. In this case I would have imagined we would have at least logged a warning about failing to resolve dependencies, which might lead to missing types. Did you see anything like that? |
Nope. So just to recap my findings; according to me, at least in my setup, if you use said recipe like so:
Where
You will, instead of a warning, see a perfectly fine output like:
|
Good to know! I guess we have a parity issue between the Maven and Gradle plugin then; in the Gradle plugin when we fail to resolve dependencies we log a warning about potentially missing type information. Looks like the same would be hepful for the Maven plugin. |
@timtebeek this is still happening on 5.21.0, the recipes run and they don't apply changes to pom files only. |
Thanks to @ammachado the latest snapshot of the Maven plugin contains a listener to help troubleshoot any download issues. Feel free to give that a try and report back here with your findings. I'll keep this issue open for a while, but we'd need input to make this actionable. |
And now also available in this release: https://github.com/openrewrite/rewrite-maven-plugin/releases/tag/v5.23.1 |
Thanks for not dropping the ball on this issue! I did give it a quick try but unfortunately can't report a tremendous improvement. Using the following rewrite.yml:
And this one-liner: The build didn't fail and the verbose logs didn't even include one single mention of this non-existent abc:xyz:123 parent pom. 🤔 |
That all looks ok to me; and is it still the case that this works fine on OS X, but is only an issue on your CI agent? |
I tried that on my local OS X machine only, however, this CI agent / OS X difference was only a beginning hypothesis, the problem later turned out to not be related to that at all, as far as I can see at least. In any case, it should be easy enough for anybody to try this out on any Maven project thanks to the steps I outlined in my last message. |
Hey, I stumbled on this again. Running
This is much better than before, as I now have a hint. However, the build went through overnight and succeeded! Meaning I thought I'd setup OpenRewrite to perform certain tasks, it's successful and I still end with the change not performed. I looked at the Maven plugin configuration page but couldn't find any option to make the presence of such an exception fail the build. Could this be further improved? |
BTW the above error is unfortunately not even in our own code. |
I believe this has been addressed with this contribution: Whenever there are failures to parse Hope that works well for you too! |
Well, thanks for coming back to this, however, I am still of the opinion that in the case of erroneous poms, it should be possible, if not by default, at least with a flag such as |
Thanks for the feedback! If you'd like to complete block recipe runs on any parse error then I suppose that'd be doable by touching some of those same lines and instead of logging throw an exception. Welcome to open a draft that reads such an argument to discuss this there. |
Hi again! We also found that logging isn't working out great on a larger scale, so we've pushed a follow up change to fail by default f592159...59404e5 Note the use of MojoFailureException, which still allows users to ignore partial failures if they really want to, and how we've pulled forward this feedback to where we parse the Maven pom files, as opposed to reporting these failures at the end. I hope that helps! |
Awesome, thank you! This is still pretty high up in my list but it keeps getting pushed down. Trying this out should be easy, however, I'll let you know soon. |
Well, unfortunately, I have mixed results to share. First of all, I don't remember where exactly I was able to trigger the error I shared on May 3rd, so can't attempt reproducing that. Second issue is that the recipe which should fail due to a non-existing target parent pom which I shared on February 22nd is still not failing with 5.40.2. |
I have OS X and
org.openrewrite.maven.ChangeParentPom
is working fine locally. On our CI agent where I'd like to make it run for a batch of projects, I've noticed:My rewrite.yml:
How I run it:
mvn org.openrewrite.maven:rewrite-maven-plugin:5.17.1:run -Drewrite.activeRecipes=info.magnolia.rewrite.UseExtensionsPoms
CI agent has Maven 3.9.6 and JDK 11.0.21+9. I'm now hours into this and still completely puzzled, so I figured I'd create this, at least to signal the possible problem with the upstream change above.
Sample pom:
The text was updated successfully, but these errors were encountered: