On 24/12/2010, at 8:37 AM, StormeHawke wrote:

> Thanks, that worked to get all the jars built.  Now, hopefully this will be 
> the last piece of this puzzle:
> 
> Most of the time, we're building for local testing or for use with our own 
> website. When we do so, we like to blanket include all ~40 family jars from 
> our core project, in addition to the standard core.jar.  Doing this with ant 
> was as simple as using an include notation something along the lines of 
> {$dist.dir}/*.jar.  
> 
> So two questions (or one, if the answer to the first covers the second):
> 
> 1) Is there some similarly easy way to do a blanket *.jar inclusion of our 
> core jars using Gradle?
> 2) How do you include a specific list of these sub-jars from core?

One option is to use some custom configurations.

When you do

dependencies {
    compile project(':api:core')
}

this includes all the jars from the 'archives' configuration in the ':api:core' 
project. You can add jars to this configuration like this, in the ':api:core' 
build script:

artifacts {
    archives someOtherJarTask
}

You can also add custom configurations to make other combinations of jars 
available:

configurations {
    someJars // maybe also: { extendsFrom runtime }
}

artifacts {
   someJars jar, someJar
}

You can reference this configuration using:

dependencies {
    compile project(path: ':api:core', configuration: 'someJars')
}

This will also take care of wiring up the task dependencies so that the jars 
are automatically built when they are needed.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to