On Dec 26, 2008, at 4:29 PM, D'Arcy, Hamlet B wrote:

I have a single project and I want to produce multiple jars from it, each jar containing a different set of dependencies and a different manifest file.

For instance, my project has:

root
--lib
----groovy-0.3.jar
----groovy-1.0.jar
----groovy-1.6.jar
--src

I want 3 jars created, each containing a different version of the groovy jar within it, and each jar having a different manifest (the manifest contains a version number).

What's the easiest way to do this?

manifest.mainAttributes(vendor: 'pearson')
libs {
        ['0.3', '1.0', '1.6'].each { version ->
                jar(appendix: version.replace(".", "_")) {
                        merge("$projectDir/lib/groovy-$version)
                        manifest = new GradleManifest(project.manifest)
                        manifest.mainAttributes(version: $version)
                }
        }
}

The above creates archive tasks with for example the name: archive_0.3_jar. This archive task generates an archive with the name <archivesBaseName>-0_3-<project.version>.jar

If you want a different name for the generated archive you can do:

libs {
        jar() {
// the generated archive has default values for its naming properties. But it is easy to overwrite them.
                baseName = '...'
                version = '...'
                extension = '...'
        }
}

- Hans



Thanks in advance,

--
Hamlet D'Arcy
[email protected]
< winmail .dat >---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to