Remove imports of old maven plugin classes for Gradle 7.0 build compat #657
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The 'maven' plugin which is deprecated for quite some time is finally removed in Gradle 7.0. This also affects the related classes (their replacements already live under org.gradle.api.publish.maven).
The ShadowJavaPlugin class currently imports them which makes it incompatible with Gradle 7 at compile time. By removing the imports and using Groovy's def variable declaration, the search for those old classes is deferred to runtime, only being called when the 'maven' plugin is applied and the classes are there as expected. So this change is compatible with use of the plugin in older Gradle versions.
As Gradle emits warnings for the jcenter repository, claiming it to be removed in Gradle 8, I followed their suggestion to change it to mavenCentral.
With this change, I am able to build and use this plugin with Gradle 7.
Fixes #658