Our Gradle script consists of root "war" project and multiple (10+) child "jar" projects. Each JAR project depends on many (30-60) JARs. Partial example:
dependencies {
compile 'dwr:dwr:3.0.0.117'
compile 'annotations:annotations:1.0'
compile 'abdera:abdera-core:0.4.0-incubating'
compile 'abdera:abdera-extensions-json:0.4.0-incubating'
compile 'abdera:abdera-extensions-main:0.4.0-incubating'
compile 'abdera:abdera-i18n:0.4.0-incubating'
compile 'abdera:abdera-parser:0.4.0-incubating'
compile 'aopalliance:aopalliance:1.0'
compile 'apacheds:apacheds-core:1.0.2'
compile 'apacheds:apacheds-core-shared:1.0.2'
compile 'apacheds:apacheds-kerberos-shared:1.0.2'
compile 'apacheds:apacheds-protocol-changepw:1.0.2'
compile 'apacheds:apacheds-protocol-kerberos:1.0.2'
compile 'apacheds:apacheds-protocol-ldap:1.0.2'
compile 'apacheds:apacheds-protocol-ntp:1.0.2'
compile 'apacheds:apacheds-protocol-shared:1.0.2'
compile 'apacheds:apacheds-server-jndi:1.0.2'
compile 'apacheds:apacheds-server-main:1.0.2'
compile 'apacheds:apacheds-server-ssl:1.0.2'
compile 'commons:commons-logging:1.0.4'
compile 'commons:commons-beanutils'
compile 'commons:commons-cli:1.0'
compile 'commons:commons-codec:1.3'
compile 'commons:commons-collections:3.2.1'
compile 'commons:commons-digester'
compile 'commons:commons-discovery:0.2'
compile 'commons:commons-fileupload:1.2'
compile 'commons:commons-io:1.2'
compile 'commons:commons-lang:2.4'
compile 'commons:commons-pool:1.5.4'
compile 'dom4j:dom4j-full'
compile 'ehcache:ehcache:1.6.2'
compile 'eigenbase:eigenbase-properties'
compile 'eigenbase:eigenbase-resgen'
compile 'eigenbase:eigenbase-xom'
compile 'FastInfoset:FastInfoset:1.2.7'
compile 'fop:fop'
compile 'freehep:freehep-export:2.1.1'
compile 'freehep:freehep-graphics2d:2.1.1'
compile 'freehep:freehep-graphicsio:2.1.1'
compile 'freehep:freehep-graphicsio-emf:2.1.1-adapted'
compile 'freehep:freehep-graphicsio-java:2.1.1'
compile 'freehep:freehep-graphicsio-pdf:2.1.1'
compile 'freehep:freehep-graphicsio-ps:2.1.1'
compile 'freehep:freehep-graphicsio-svg:2.1.1'
compile 'freehep:freehep-graphicsio-swf:2.1.1'
compile 'freehep:freehep-graphicsio-tests:2.1.1'
compile 'freehep:freehep-io:2.0.2'
compile 'freehep:freehep-swing:2.0.3'
compile 'freehep:freehep-util:2.0.2'
compile 'freehep:freehep-xml:2.1.1'
}
I would like to avoid having such long duplicated list of dependencies for each component. There should be a way to group dependencies, for example "freehep", "commons", "apacheds", "abdera", "dwr", and than each component would reference those groups.
Add the following to the root project:
then include it in subprojects like this:
This way you can define as many dependency lists as you want and include them as frequently as you want, in any combinations.