In a multi-project I have created a plugin in buildSrc that sets up a new configuration and adds one project of this multi-project build as a default dependency
We run a custom test tool as JavaExec - the code for it is currently in the project itself and has it’s own dependencies. Therefore the custom configuration for defining the basic classpath of the tool.
I wanted to define a default but allow for the individual projects using this tool to change the classpath of it.
Hm - but actually I don’t think you would want exchange the project dependency itself but only add to the configuration if needed. That would not need the default dependency mechanism.
I would agree that it should be supported or prevented. Currently I can not give a useful use case so preventing might be easier?
Thanks. I couldn’t come up with a good use case either. I think the defaultDependencies case is going to be mostly used for tools, like you’re saying, instead of compile or testCompile dependencies (or similar).
The best I can come up with is a situation where:
A plugin exists to configure a tool
Published versions of a tool exist
A local subproject produces a modified version of the tool
All projects in the multi-project build should use the local subproject’s version
Except a few projects should still use the published version
In that case, using the plugin to define a default dependency for the local project maybe makes sense. It would probably be clearer to use dependency substitution instead or directly put the dependency in each project.
Yes - I’m sure someone somewhere will have that exact requirements - but it sounds somehow far fetched and as you said there are other ways to make it work (and that’s why I love Gradle).
Thanks for your time. I think it should simply be prohibited to make it explicit and to prevent confusing people like me