On 05/01/2011, at 1:10 AM, Mathias Kalb wrote: > Hi, > > we have some logging JARs (log4j, slf4j, ...) at "tomcat\lib". Every > subproject (JAR/WAR) can use this JARs for "compile" and "runtime". > > I want to define the dependencies at one place and every subproject should > use them as a compile dependency. > > I tried the following at the "main" build.gradle. But how can I use it at the > subprojects? > > configurations { > tomcatLib > } > > dependencies { > tomcatLib group: 'log4j', name: 'log4j', version: '1.2.+' > tomcatLib group: 'javax.mail', name: 'mail', version: '1.+' > tomcatLib group: 'org.slf4j', name: 'slf4j-api', version: '1.+' > tomcatLib group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.+' > tomcatLib group: 'commons-logging', name: 'commons-logging', version: > '1.+' > }
You can do something like: subprojects { configurations { tomcatLib } dependencies { tomcatLib ... } plugins.withType(JavaPlugin).allObjects { configurations { compile.extendsFrom tomcatLib } } plugins.withType(WarPlugin).allObjects { configurations { providedCompile.extendsFrom tomcatLib } } } -- Adam Murdoch Gradle Developer http://www.gradle.org CTO, Gradle Inc. - Gradle Training, Support, Consulting http://www.gradle.biz