-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Version Catalog API: Dependency classifier can not be specified? #17169
Comments
This isn't a bug but a design decision: https://melix.github.io/blog/2021/03/version-catalogs-faq.html#_why_can_t_i_use_excludes_or_classifiers |
@melix Well ok, seems reasonable. Then I would suggest updating the official documentation with all the information of your blog post. Seems like a valuable FAQ. |
Is it really? I see 2 major issues with the current limitations of version catalogs:
The design decisions as outlined in the post might or might not be warranted. I agree that the use case outlined there is valid, but so is the use case where 2..n sub-projects reverence the same library from the version catalog and it is in contrast to the idea of central declaration of dependencies if each sub-project has to apply the same constraint again in each sub-project. It could be warranted to have the option to apply the constraint once when declaring the |
Thank you for your interest in Gradle! This is a valid documentation issue that we will address. @melix is correct here. The version catalog is about a collection of dependency coordinates and their versions. It is not about the configuration where the dependency is to be used nor is it about the variant that is to be selected (classifier is the legacy way of declaring a variant). That info belongs to the consumer project and there are ways to centralize that, e.g. platforms or convention plugins. |
There is actually a bug in Gradle wrt classifiers and version catalogs. The approach that is recommended here, like this one:
leads to broken published Gradle module metadata - consumers of the published Gradle module metadata encounter broken dependencies. I suspect that the recommended way to specify a different artifact is broken in the same way for consumers of published Gradle module metadata. This ugly workaround however works:
Another ugly workaround is to not consume Gradle module metadata, like this. See also: /cc @melix |
@snazy, care to open a separate issue about this bug? |
I have projects that explicitly depend on Java sources but currently it seems impossible to declare a dependency classifier in the Version Catalog API / toml file.
Expected Behavior
The text was updated successfully, but these errors were encountered: