Common dependencies between sub-projects

Lets assume that I have a fairly large project with both java and non-java projects,
Only a few java projects share common libraries. lets say commons-lang.

What’s the recommended approach to defining common dependencies between these two projects.
I tried defining the common libraries as an array of Strings like,

ext.commons = [
“commons-io:commons-io:2.4”,
“commons-httpclient:commons-httpclient:3.1”,
“commons-lang:commons-lang:2.6”
]

How do I refer this from two projects - lets say projectA and projectB ?

There’s no recommended approach in Gradle. The option you lay out is one common practice though. I’d actually represent the common libraries as a Map data structure which makes it easier access specific dependencies based on a key.

For your example you’d use it as such:

dependencies {
    ext.commons.each { notation ->
        compile notation  
    } 
}