Where do I have to put the dependency classifier when declaring a dependency using a Gradle Version Catalog?
E.g. io.netty:netty-transport-native-epoll:4.1.74.Final:linux-x86_64
Using vanilla implementation function:
implementation("io.netty:netty-transport-native-epoll:4.1.74.Final:linux-x86_64")
and it works, but how to do the same using catalog:
netty-epoll-linux = { group = "io.netty", name = "netty-transport-native-epoll", version = "4.1.74.Final", ????? classifier="linux-x86_64" - doesn't work }
There is nothing in the version catalog to specify classifiers. You have to put the classifier in the dependency declaration:
implementation(variantOf(libs.netty-epoll-linux) { classifier("linux-x86_64") })
Frequently asked questions about version catalogs explains this design choice:
By design, version catalogs talk about dependency coordinates only. The choice of applying excludes is on the consumer side: for example, for a specific project, you might need to exclude a transitive dependency because you don’t use the code path which exercises this dependency, but this might not be the case for all places. Similarly, a classifier falls into the category of variant selectors: for the same dependency coordinates, one might want classifier X, another classifier Y, and it’s not necessarily allowed to have both in the same graph. Therefore, classifiers need to be declared on the dependency declaration site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With