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

Gradle does not report classpath conflicts when loading plugins #19457

Open
britter opened this issue Dec 30, 2021 · 3 comments
Open

Gradle does not report classpath conflicts when loading plugins #19457

britter opened this issue Dec 30, 2021 · 3 comments

Comments

@britter
Copy link
Contributor

britter commented Dec 30, 2021

When several plugins request different incompatible versions of the same library, Gradle does not report this as an error. Instead the build fails with runtime a runtime error.

Expected Behavior

If several plugins depend on incompatible versions of the same library, Gradle should report this as an error.

Current Behavior

Gradle silently selects one version of the library which causes errors at build time.

Context

This was reported as britter/maven-plugin-development#65 but it turned out to be plugin classpath issue. The reporter applied maven-plugin-development plugin together with several other plugins that depend on the com.thoughtworks.qdox:qdox module. maven-plugin-development plugin depends on com.thoughtworks.qdox:qdox:2.0-M5 and defines this as a constraint: https://github.com/britter/maven-plugin-development/blob/f710c414301386ef52b477a738119b148a866e87/subprojects/plugin/build.gradle.kts#L58-L62. Several other plugins depend on com.thoughtworks.qdox:qdox:1.12.1. See https://scans.gradle.com/s/6zdhoqgumbhcs/build-dependencies?dependencies=qdox&expandAll&focusedDependency=WzEsMCwxNTgsWzEsMCxbMV1dXQ&focusedDependencyView=versions

The only way to fix this is removing conflicting plugins from the using build.

The only way to fix this in maven-plugin-development is to relocate all plugin dependencies.

Steps to Reproduce

See britter/maven-plugin-development#65 (comment)

Your Environment

Build scan URL: https://scans.gradle.com/s/6zdhoqgumbhcs

@ov7a
Copy link
Member

ov7a commented Aug 15, 2024

Sorry for the late reply.

This issue needs a decision from the team responsible for that area. They have been informed. Response time may vary.

@ov7a ov7a added in:dependency-resolution engine metadata 👋 team-triage Issues that need to be triaged by a specific team and removed to-triage labels Aug 15, 2024
@jvandort jvandort added this to the 9.x milestone Aug 18, 2024
@jvandort jvandort removed the 👋 team-triage Issues that need to be triaged by a specific team label Aug 18, 2024
@jvandort
Copy link
Member

In 9.x we plan to restrict all projects within a single build to have the same classpath.

This means in Gradle 9.x, we will deprecate using the buildscript block in any project other than the root project of a build, and will enforce all plugins to be apply false'd at the root-level if they are to be applied in any subproject.

@britter
Copy link
Contributor Author

britter commented Aug 20, 2024

@jvandort I don't think a single classpath across all projects will help in this situation. What this ticket is about, is a plugin dependency conflict that is not reported by Gradle. Instead the build just crashes at runtime. In my opinion the same mechanics as when resolving project dependencies should be applied to resolving plugin dependencies, so that a conflict is reported at configuration time, not at build runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants