Hello
Recently I’ve been needing to use optional dependencies and found this blog post Optional dependencies are not optional
I would like to use this to declare a capability that if activated brings another internal dependency from a different place, but I couldn’t get it to work
My internal library is :infra:cache
, and it should allow using another internal library called :our-project:parent-http:http-server
if using feature
capability
Part of :infra:cache
java {
registerFeature('feature') {
usingSourceSet(sourceSets.main)
}
}
dependencies {
featureImplementation project(":our-project:parent-http:http-server")
}
And in another place I’ve added this
dependencies {
implementation project(":infra:cache")
implementation(project(":infra:cache")) {
capabilities {
requireCapability(project(":infra:cache-feature")
}
}
}
I tried any combination I could think of but always end up with failing to resolve the capability
What am I doing wrong?
(We’re on gradle 6.9)