Adam -
I'm not quite following, though I'm following enough to infer that the
configuration below isn't the way to go (Wasn't too satisfied with it
anyway). I've trimmed down the core project somewhat to make it easier
to see what's going on. I would greatly appreciate some clarification
So say I have a project someProject that depends on core.jar plus an
arbitrary subset of some or all of the individual jars. So someProject
needs to be configurably able to depend on some or all of core's jars.
project(':app:someProject') {
// Not sure how to put together your email into contents for this section.
// Also - would I need to build separate war/compile tasks for each
configuration,
// and hence for each dependent project, or is there a way to specify
configuration
// from the command line?
}
// This is the cut-down version of my core project. I suspect I'm not
understanding the
// proper use of the "configurations" and "artifacts" sections
project(':api:core') {
version = 1.0
configurations {
core
caa
cac
car
cas
}
dependencies {
compile project(':api:util')
compile project(':api:schema')
}
jar {
baseName = 'core'
dependsOn classes, ':api:core:caaJar', ':api:core:cacJar',
':api:core:carJar', ':api:core:casJar'
from sourceSets.main.classes
exclude('net/intellidata/core/**/*Impl*')
}
task caaJar(type: Jar) {
baseName = 'caa'
dependsOn classes
from sourceSets.main.classes
include('net/intellidata/core/**/CAA*Impl*')
}
task cacJar(type: Jar) {
baseName = 'cac'
dependsOn classes
from sourceSets.main.classes
include('net/intellidata/core/**/CAC*Impl*')
}
task carJar(type: Jar) {
baseName = 'car'
dependsOn classes
from sourceSets.main.classes
include('net/intellidata/core/**/CAR*Impl*')
}
task casJar(type: Jar) {
baseName = 'cas'
dependsOn classes
from sourceSets.main.classes
include('net/intellidata/core/**/CAS*Impl*')
}
artifacts {
caa caaJar
cac cacJar
car carJar
cas casJar
}
}
On 12/27/2010 2:24 PM, Adam Murdoch-3 [via Gradle] wrote:
>
> 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
>
>
>
> ------------------------------------------------------------------------
> View message @
> http://gradle.1045684.n5.nabble.com/How-to-exclude-some-classes-from-jar-tp3315811p3319742.html
> To unsubscribe from How to exclude some classes from jar, click here
> <http://gradle.1045684.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3315811&code=YnJpYW4udHJlemlzZUBpbnRlbGxpZGF0YS5uZXR8MzMxNTgxMXwxMTE4NTY2NjA4>.
>
>
--
View this message in context:
http://gradle.1045684.n5.nabble.com/How-to-exclude-some-classes-from-jar-tp3315811p3319774.html
Sent from the gradle-user mailing list archive at Nabble.com.