I know I can use capability-aware for more complex...
# dependency-management
i
I know I can use capability-aware for more complex dependency resolution situations. However, from what I can tell, this also works out to "one artifact is resolved to a single variant". I'd like to provide optional functionality from a single artifact, so I'd like to let users depend on multiple variants of that artifact (which they will enable by using a plugin which sets everything up). Is this possible? If so, by which mechanism?
1
j
Take a look at Library Features
i
Ah, I see… So if each variant has a distinct capability, then the user can depend on each capability and thus get multiple variants in the same configuration?
j
Yes. There is a restriction that in a single dependency graph, you cannot have multiple variants with the same capability. This is because a capability models the "contents" of a variant's artifacts. You don't want two artifacts in a graph that provide the same thing (you don't want duplicate classes on a classpath) By exposing variants from a component with different capabilities, you can permit those variants to exist in the graph simultaneously. Then, users can specifically request those variants by their capability
1