Skip to content
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-maven-plugin no longer compatible with Java 17 #834

Closed
motlin opened this issue Aug 9, 2024 · 7 comments
Closed

rewrite-maven-plugin no longer compatible with Java 17 #834

motlin opened this issue Aug 9, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@motlin
Copy link

motlin commented Aug 9, 2024

Dependabot opened a PR against my project bumping org.openrewrite.maven:rewrite-maven-plugin from 5.37.1 to 5.38.0.

My project has a GitHub workflow configured to run dryRunNoFork, which fails with the error:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:5.38.0:dryRunNoFork (OpenRewrite dry run) on project liftwizard-parent-build: The plugin org.openrewrite.maven:rewrite-maven-plugin:5.38.0 has unmet prerequisites: Required Java version 21 is not met by current version: 17.0.10

Looking at the diffs in v5.37.1...v5.38.0, I see that rewrite-java-21 was added, but that source and target version numbers were not bumped, so I believe this incompatibility is unintentional.

@motlin motlin added the bug Something isn't working label Aug 9, 2024
@timtebeek
Copy link
Contributor

timtebeek commented Aug 9, 2024

Apologies! That's quite unexpected; I've reverted that change for now and will make it into the next release. We'll have to revisit this more carefully in the near future. Thanks for the quick report!

@timtebeek timtebeek self-assigned this Aug 9, 2024
@motlin
Copy link
Author

motlin commented Oct 10, 2024

This issue is reoccurring now that #872 is released.

@timtebeek timtebeek reopened this Oct 10, 2024
@timtebeek
Copy link
Contributor

Thanks for the quick feedback @motlin ! I think we have a structural fix now, whereas before we were relying on an automatically detected required Java version. I've ran a local snapshot against liftwizard using Java 17 and no longer see any issues, so thanks for providing that context above! 🙏🏻

Also be sure to let us know if you develop any Dropwizard related recipes, or would like to collaborate on some. I imagine there's some potential for migration recipes there as well, and happy to accommodate with say a rewrite-dropwizard module.

@motlin
Copy link
Author

motlin commented Oct 11, 2024

Also be sure to let us know if you develop any Dropwizard related recipes, or would like to collaborate on some. I imagine there's some potential for migration recipes there as well, and happy to accommodate with say a rewrite-dropwizard module.

That is a great idea. We're stuck on Dropwizard 2.x at my work, and so I've stayed with the same dependency in Liftwizard. The Dropwizard 3.x upgrade involves package moves that OpenRewrite would be perfect for. The Dropwizard 4.x upgrade involves moving from javax to jakarta, which looks like it's completely covered by an existing recipe.

I'll talk to coworkers about attempting the Dropwizard 3.x upgrade in the near future using OpenRewrite and working in the open.

@timtebeek
Copy link
Contributor

Thanks for the helpful links: at a quick glance we already have recipes for

  1. the Apache HttpClient 4 to 5 migration
  2. the Change package for Dropwizard
  3. JUnit 4 to 5 migration
  4. Hibernate 6.0 and 6.1 migration
  5. Jakarta migration

In that sense I suspect any rewrite-dropwizard would be very similar to how we've supported Apache Wicket: Mostly yaml recipes that you can compose in our recipe builder.

Happy to work together, as I imagine there's more folks that want to move to newer versions still.

@motlin
Copy link
Author

motlin commented Oct 11, 2024

the Change package for Dropwizard

Is there a recipe like org.openrewrite.java.ChangePackage to split up a package? The package io.dropwizard got split up into several packages. I think I'll need to list a bunch of fully qualified class names.

@timtebeek
Copy link
Contributor

the Change package for Dropwizard

Is there a recipe like org.openrewrite.java.ChangePackage to split up a package? The package io.dropwizard got split up into several packages. I think I'll need to list a bunch of fully qualified class names.

You can use ChangePackage and ChangeType together, even if the intermediate result would not be valid. That way you can "move" everything over to the new package, and then "move" some of the classes to the other part of the split package. I hope that's clear; Feel free to when you want to start a module and work from the tests there. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants