When building an EAR using a task, how do you include and then rename a JAR file built by another task?

Gradle Forums,

Have the following task which builds a JAR file: task baseJar1(type: Jar, group: ‘Custom Jar’, description: ‘Packages base1 jar file’) {

baseName ‘base1’

from (sourceSets.main.output.classesDir) {

include ‘**/*.class’

}

manifest {

from ("$jsrcDir/services.mf")

} }

And have the following task which builds an EAR file: task servicesEar(type: Ear, group: Custom Ear’, description: ‘Packages services ear file’) {

baseName ‘services’

metaInf {

from (jsrcDir) {

include ‘application.xml’

}

}

from (baseJar1.archivePath)

}

The EAR task above bundles the JAR built by the baseJar1 task properly but we need to rename the resulting jar in the EAR to ‘specific.jar’. How can this be accomplished?

Thanks, Rick