You should probably look at the maven plugin: http://www.gradle.org/maven_plugin.html
As for the multiple artifacts, it would probably be easiest to just assign different classifiers for them - similar to uploading source and javadoc jars: http://gradle.1045684.n5.nabble.com/javadoc-and-source-jars-td3246213.html On Thu, Jun 16, 2011 at 1:45 PM, Mark Davidson <ukd...@googlemail.com>wrote: > This approach works great. > > My next question is - how can I deploy the generated jars to a repository? > I've read up about addFilter() but can't figure out how to use this to > upload the jars with same groupId and unique artifactId (e.g. > "$prefix.$jarname"). Any ideas? > > Regards > > Mark > > On 15 June 2011 19:19, Eric Berry <elbe...@gmail.com> 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 <ukd...@googlemail.com>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 >> > > -- 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