Dependency validation fails on Gradle plugins
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 109
- Forks
- 6
- Avg merge
- 11m
- Merged PRs (30d)
- 3
Description
Description
Using the java-gradle-plugin adds gradleApi() as an api (or compileOnlyApi in Gradle 9.4) dependency.
This is problematic because:
gradle-apicontains multi-release bycode in unexpected locations which makes the class file version verification fail- It uses the version of Gradle you're using to build in your compile dependencies while you usually want conservative libraries with liberal tooling.
Workaround:
set org.gradle.unsafe.suppress-gradle-api=true in your gradle.properties
echo 'org.gradle.unsafe.suppress-gradle-api=true' >> gradle.properties
Add the correct minimum version of Gradle you want to support:
dependencies {
compileOnlyApi("org.gradle.experimental:gradle-public-api-internal:$gradleVersion")
}
Or if if gradle-public-api-internal is not published for the version of Gradle you're targeting, you may use the Nokee redistributed artifacts:
dependencies {
compileOnlyApi("dev.gradleplugins:gradle-api:$gradleVersion")
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing dependency validation for a project using the java-gradle-plugin, then inspect how gradleApi() and the suppress-gradle-api setting affect validation. Compare the behavior with the documented compileOnlyApi alternatives and verify that supported Gradle versions no longer trigger the reported class-file validation failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100