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

Stop using JavaPluginConvention for Gradle 7.1+ #299

Merged
merged 2 commits into from
May 19, 2024

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Mar 27, 2024

The org.gradle.api.plugins.JavaPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#java_convention_deprecation

Fixes #307

Comment on lines +107 to +110
//Using the older javaConvention because we need to support older versions of gradle.
@SuppressWarnings("deprecation")
JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
sourceSets = javaConvention.getSourceSets();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work for now, but if 9.0 actually removes the conventions or JavaPluginConvention, then this code will no longer compile when the Gradle wrapper is upgraded to 9.0 in this repo and will require being refactored again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code will no longer compile when the Gradle wrapper is upgraded to 9.0 in this repo and will require being refactored again.

Yes, but I think released versions will still works fine with 9.0+, and no warning for 7.1+.

The org.gradle.api.plugins.JavaPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#java_convention_deprecation
@quaff quaff changed the title Stop using JavaPluginConvention if Gradle is higher than 7.0 Stop using JavaPluginConvention for Gradle 7.1+ Mar 27, 2024
@timtebeek timtebeek added the enhancement New feature or request label May 19, 2024
@timtebeek
Copy link
Contributor

Thanks a lot for this @quaff ! Any concerns before we merge this in @shanman190 ?

@shanman190
Copy link
Collaborator

For now this is probably fine for now at least.

The one concern that comes to mind is on JVMs that preemptively load all classes and the JavaPluginConvention actually being removed. In that case, we would most definitely begin to receive reports of the plugin failing to load the old class. These JVMs seem to be fairly uncommon though.

@timtebeek timtebeek merged commit 6121f79 into openrewrite:main May 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Gradle 8.x Deprecates PluginConvention and will be Removed in Gradle 9.0
3 participants