Hey, Not sure what's the best strategy here (perhaps others will speak up :). One of the ways is to use configurations:
Project A: apply plugin: 'java' configurations { extraJars } ... artifacts { extraJars javadocJar extraJars sourcesJar } Project B: apply plugin: 'war' dependencies { compile project(path: ':A', configuration: 'archives') } Hope that helps! Szczepan On Tue, Mar 22, 2011 at 12:58 PM, Sten Roger Sandvik <ste...@gmail.com>wrote: > Hi. > > I have a problem that my war file includes by default all sources and > javadoc artifacts from a project dependency. Have lillustrated my two > projects below (A and B). Project A is a simple jar file that also jave > sources and javadoc artifacts. Project B is a war file that uses project A > as a compile dependency. Project B includes A.jar, A-sources.jar and > A-javadoc.jar. How can I make gradle to only include my classes jar file? > > Project A: > apply plugin: 'java' > > task javadocJar(type: Jar, dependsOn: javadoc) { > from javadoc.destinationDir > classifier = 'javadoc' > } > > task sourcesJar(type: Jar, dependsOn: compileJava) { > from sourceSets.main.allSource > classifier = 'sources' > } > > artifacts { > archives javadocJar > archives sourcesJar > } > > Project B: > apply plugin: 'war' > > dependencies { > compile project(':A') > } > > > > >