I have a projects which provides a number of adaptors to third-party libraries. Each adaptor is small enough, so putting it in its own projects would be an overkill. Clients of the library would typially use one or few adaptors, so I would like to make the third party dependencies optional. That is, when client projects depend on the adaptors project, the regular dependencies will be added transitively, while the ‘optional’ dependencies on third party libs will be ignored.
I assume that I can do this by poking with the ‘default’ configuration, but I am not sure when is the best hook (i.e. can I do it in the dependency section, or do I need to wait until the deps are resolved?
An example will be very appreciated - i.e. take this as a starting point:
project.name = "My Fancy Loggers"
dependencies {
compile project("myCoreUtils")
// this one should always be added transitively
.
compile "log4j:log4j:1.23",
// these should be optional and
"jakarta:commons-logging:1.23",
// not included in the 'default' config
"logback:logback:0.45:6"
}