That works perfectly - many thanks!

Regards

Mark

On 15 June 2011 19:19, Eric Berry <[email protected]> wrote:

> You should be able to do this. You don't even need the extra task really,
> unless you want just one task to run.
>
> You can set this up similar to below in the config phase:
> [code]
> def components = [
>    [name: "foo"],
>    [name: "bar"],
>    [name: "baz"]
> ]
>
> components.each { comp ->
>    project.task(comp.name, type: Jar) {
>    }
> }
> [/code]
>
> If you run 'gradle tasks' you'll see 3 new tasks 'foo', 'bar', and 'baz'.
>
> You could go further and add each of these tasks to the artifacts closure
> so that the jars will be produced when you build the project.
>
>
>
>
> On Wed, Jun 15, 2011 at 4:26 AM, Mark Davidson <[email protected]>wrote:
>
>> Hi there
>>
>> I have a project that I want to package as a large number of jars (~30).
>> I've seen a solution on the mailing list that looks like this:
>>
>> jar {
>>     include 'com/mycompany/package1/**'
>> }
>>
>> task otherJar(type: Jar) {
>>     from sourceSets.main.classes
>>     include 'com/mycompany/package2/**'
>>     // you will need something to distinguish this jar from the other,
>> one of:
>>     // baseName = 'myotherjar'
>>     // classifier = 'someclassifier'
>>     // customName = 'myotherjar.jar'
>> }
>>
>> I accept that this would work for me however I was hoping to do something
>> like this to reduce the amount jar-type tasks:
>>
>> def components = [
>>     [name: 'validate-metadata', title: 'Validate Metadata Component',
>> pattern: 'com/mycompany/package1/**']
>>     [name: 'generate-pdf', title: 'Generate PDF Component', pattern:
>> 'com/mycompany/package2/**']
>>     [name: 'approve-package', title: 'Approve Package Component', pattern:
>> 'com/mycompany/package3/**']
>>     etc..
>> ]
>>
>> task createComponents {
>>     components.each { c ->
>>         // call some jar-type task..
>>     }
>> }
>>
>> Is this possible? Would I have to use AntBuilder to do this?
>>
>> Cheers
>>
>> Mark
>>
>
>
>
> --
> Learn from the past. Live in the present. Plan for the future.
> Blog: http://eric-berry.blogspot.com
> jEdit <http://www.jedit.org> - Programmer's Text Editor
> Bazaar <http://bazaar.canonical.com> - Version Control for Humans
>

Reply via email to