2011
01.20
01.20
I believe you’ll find this in every gradle project you can download from the net. Since it’s groovy it’s best to just declare a map with your external dependencies in root project. You can then use it in your subprojects just by accessing a key from map.
Let’s see a sample configuration:
// def versions would create script local variable
versions = [
camel: "2.5.0"
]
libraries = [
camel: [group:"org.apache.camel", name:"camel-core", version:versions.camel],
camelBindy: "org.apache.camel:camel-bindy:${versions.camel}"
]
You can see two maps actually: versions and variables.
First one defines versions used for particular libraries. Since camel version is used in multiple places, you can just extract it and keep outside the libraries definitions.
Libraries is a map of our dependencies.
Usage is also simple:
// somewhere in root project or subprojects
dependencies {
compile libraries.camel
compile libraries.camelBindy
}
No Comment.
Add Your Comment