I have a complex Gradle project with some sub-projects having optional dependencies which are normally not used; I guess this can be modeled by features/capabilities. Among this sub-projects there is a ‘main’ sub-project which has dependencies on other sub-projects. This ‘main’ sub-project has test code which needs optional dependencies to be present in runtime.
How can I enable optional dependencies for ALL sub-projects used in ‘main’, but only for test code? Preferably without copy/pasting all ‘main’ dependencies twice - once for main code and one more time for test code with enabled capability.