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
The exclude won't be able to exclude rewritten dependency #17964
Comments
This is indeed a consequence of the way excludes are processed in dependency graph resolution:
As a consequence:
Ideally Gradle should fix that first use case while I believe the second one is an OK behavior. For implementation details, check Note that a workaround to fix this in your case is to make sure to exclude as well the source of the substitution. |
Thanks for the suggestions. However, it is almost impossible to add both exclude to thousands of projects. Due to this issue, the central dependencies substation rule we had will cause a lot of projects at our company to break. |
Hi @ljacomet , I tried to submit a pull request to fix it issue, how could I get it reviewed from the Gradle community? |
Thanks for submitting the PR, just started the tests and conversation over there. |
Potential backport request for 6.9.x: #18163 |
Even if I add an exclude rule to exclude "com.google.guava:guava", if other dependencies are rewritten to "com.google.guava:guava", I will still get it in the dependency graph.
Take the following project for example:
I already added an exclude rule:
exclude group: "com.google.guava", module: "guava"
However, I still get guava in my dependency graph
Expected Behavior
If I exclude a dependency, I should not have it in my dependency graph anymore. No matter what.
Current Behavior
clone this repo: https://github.com/attix-zhang/test-gradle-exclude-with-substitution
and then run
./gradlew dependencyInsight --dependency com.google.guava:guava --configuration compileClasspath
,You will still get guava in the compileClasspath.
Context
Our company has some dependency substitution rules and every project is required to use. With this bug, each individual project is unable to exclude dependencies cleanly.
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: