I have two configurations extending one another. H...
# community-support
l
I have two configurations extending one another. How do you make sure the sub-configuration actually takes the exact same files as the super-configuration's, instead of going off and resolving completely different variants on its own?
v
You don't 🙂
Often that's the point, that you want to get different attributes / variants.
The actual resolvable configuration you resolve is the one controlling which attributes are requested.
Well, except for attributes declared on the actual dependency directly
l
I guess the attribute system is useless for my purposes then. I need a certain variant on the compileClasspath, but that variant is only specified by custom attributes. But adding those custom attributes to compileClasspath will then filter out all of the normal Java archives, but not having the custom attributes makes it select a completely random artifact.
I keep running into these not-at-all-niche edge cases that make me question if the whole build system can even support anything off the beaten path.
v
adding those custom attributes to compileClasspath will then filter out all of the normal Java archives
Why should it? If you request an attribute then a producer variant that does not provide it is considered compatible.
that make me question if the whole build system can even support anything off the beaten path
Yes, it can support maaany things with great flexibility. That is one of the key strengths of Gradle. It provides senseful conventions so that the "beaten path" is easy to use, while providing great flexibility to do almost anything you can imagine.
And even if "it is considered compatible" would not be true - which it is - you could also anytime use a component metadata rule to ad-hoc on-the-fly change the existing variants adding the attribute or declaring additional variants. But it is not necessary in the mentioned case.