Custom configuration and resolving only compile dependencies

Attributes are used to drive the variant aware dependency resolution.
https://docs.gradle.org/current/userguide/variant_model.html
https://docs.gradle.org/current/userguide/variant_attributes.html

At the very least you need to define org.gradle.usage=JAVA_API to get what you want.

// optional; you can also describe the intended usage of your configuration
config.canBeConsumed = false 
config.canBeResolved = true
config.attributes {
    attribute( Usage.USAGE_ATTRIBUTE, objects.named( Usage, Usage.JAVA_API ) )
}
1 Like