Why does my consumer prefer java 8 variant to java 11 variant while building with Java 11?

I think what you both might be having trouble with is that registering a feature variant creates a new capability (essentially a new sub-GAV). This is not the same thing as creating a new outgoing variant of the original capability (the GAV of the project). @Pierre1 this is why things work when using requireCapability. I’m not an expert on this either, so I could be completely mistaken. I would agree with you if you thought the term “variant” has been overloaded a bit.

Unfortunately I do not have a direct solution on hand for you. However, I think you should not use “feature variants” and instead do something similar to the instrumented-jars example here, but without actually creating a new library elements value.

You could try attaching additional capabilities that match the project’s capabilities to the feature variant’s outgoing configs. However, I’m not sure if that lands you in hack/abuse territory.

Best of luck!

1 Like