Is it possible to publish two (or more) variants o...
# community-support
s
Is it possible to publish two (or more) variants of a module BUT have one variant specified as some kind of default so that consumers who are blissfully unaware of all this variant business but are using Gradle would select this variant automatically? My understanding is that if the consumers won't have attribute rules configured they would fail due to ambiguous variants, but I would like to avoid that for legacy consumers.
👀 1
j
Yeah, if one variant is just missing a matching attribute and the consumer doesn't request its presence then it will use that variant. Though it might be good to do some additional testing.
s
In my case the variants would differ in the usage attribute. Legacy consumers do not request it but both variants would have it. Do you mean that if one of the variants has another dummy attribute that nobody requests, then the other variant will be preferred?
j
Ah, in that case I don't know. If all requested attributes are identical between variants then it will freak out and fail.
v
If those legacy consumers are ancient Gradle versions that do not know about variants, there will be no problem as they don't know about the variants. If you talk about modern Gradle versions not manually created configurations that do not request any attribute, you should follow through https://docs.gradle.org/current/userguide/variant_aware_resolution.html#sec:abm-algorithm it describes how a variant is selected. I guess there it will be the variant with the smallest amount of extra attributes.