I am trying to refactor the way that I declare my dependencies in my project.
I am currently using the method described in this answer.
For example:
In top level build.gradle
I am defining my dependency as a constant as so:
ext.libraries = [
junit: 'junit:junit:4.10'
]
Then referencing it in the sub-module build.gradle
like so:
testCompile([
libraries.junit
])
Is the only advantage of doing this that it saves memory?
My current understanding is that by defining a dependency in the typical Gradle way in the top level build.gradle
, it is then added to EVERY sub-module.
But by defining it as a property and only referencing the property in the sub-modules that use it, you are saving memory as it is only added to the sub-modules that need it?
Am I correct?