Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify classifier when using a gradle version catalog?

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 }
like image 539
slesh Avatar asked Mar 28 '26 11:03

slesh


1 Answers

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.

like image 107
Kolargol00 Avatar answered Mar 30 '26 00:03

Kolargol00



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!