I am trying to declare the dependencies
in my gradle project using the technique described in this answer.
However when I do so I get this error:
No such property: libraries for class
How can I fix this?
Dependencies declared as properties at top level build.gradle as follows:
ext.libraries = [
junit: 'junit:junit:4.10'
]
Trying to retrieve dependency in module level build.gradle (where error is being thrown):
testCompile([
libraries.junit
])
Error thrown:
No such property: libraries for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
In your top level
settings.gradle
, include your subproject:In your top level
build.gradle
define your ext properties:it does not have to be a map, if you're using just 1 value, but I'm sticking with your formatting.
To use this in your
subproject build.gradle
: