Gradle Build Mutliple Jar Files


(Parag) #1

Hello All

A gradle newbie here.

I have an existing ant build script that builds 3 Jar files.

I am trying to create a gradle.build file to replicate this.

I have managed build the main Jar file using a build.gradle script.
I am not sure how to build the other Jar files from within the same build script.

Do I need to use the Multi-project builds for this or is there another was to do this?

any help would be much appreciated.

thank you


(Lance Java) #2
task extraJar(type: Jar) { ... }
task extraZip(type: Zip) { ... }
def someRandomFile = file("path/to/file.zip")

assemble.dependsOn extraJar
assemble.dependsOn extraZip

artifacts {
    archives extraJar
    archives extraZip
    archives someRandomFile 
}

More info here