Is it possible to share configurations, especially...
# gradle
d
Is it possible to share configurations, especially resolved configurations, from other projects i a multi-project build ? I have a build with about 20 sub-projects which include many dependancies the build configuration time is very slow -- I watch the gradle output as it re-resolves the same configurations over and over for each project. ( I have allprojects { dependencies { implementation somecommonconfig } } } ) If the configuration is the same among child projects -- is there a way to just put it in the root project and reference it in child projects so it doesn havev to re-resolve everything ? This could have complications if child projects have different repository sets -- so perhaps that would need to be constrained, or ignored .
g
Looks that you have some problem in one of your plugins that cause Dependency resolution on configuration time. I would check build scan of your project to see what is going on
d
Thanks. You are correct. The vast time was during configuration. Build Scan didnt indicate which but gave me a clue. I am testing now. I belive its due to using the spring bom plugin, but giving it a changing version# ( :11+) I then introspect the discovered version number to force on all jars from the same module -- (aws sdk in this case). This helped solve problems of transitive dependanciees not using the BOM so I'd get 2-3 versions of the same file. But now I suspect I implemented this badly, and should instead pick the version upfront
g
Yes, build scan only can show you that dependencies are resolved in configuration time.
there is a snippet somewhere, that helps find bad plugin, where you add listener on dependency resolution and throw an exception if some plugin tries to resolve dependencies in configuration time.
d
Forcing a fixed version number instead of :11+ and not using the resolved version from the BOM as the version for the dependant files worked. Now 0.00 of time is spent dependency resolving during config time
Total build time improved for cases where there was mostly no work to be done in tasks. Worse case clean build same appox time.