# Gradle - Create multiple JARs

**URL:** <https://discuss.gradle.org/t/gradle-create-multiple-jars/26955>\
**Category:** Help/Discuss\
**Created:** [May 16, 2018, 5:00pm UTC](https://discuss.gradle.org/t/gradle-create-multiple-jars/26955 "2018-05-16T17:00:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jatinpabari](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@jatinpabari](https://discuss.gradle.org/u/jatinpabari)\
**Post date:** [May 16, 2018, 5:00pm UTC](https://discuss.gradle.org/t/gradle-create-multiple-jars/26955/1 "2018-05-16T17:00:04Z")

</div>

Hi,

My project structure is:

parent  
–child1  
–child2  
–child3

My requirement is to create multiple JARs such as child1.jar, child2.jar etc.) While java plugin takes care of this, I would like to create couple of JARs which would contain mix and match of source files from child projects (such as customized1.jar comprising of classes from child1 and child3).

When I execute multiple JAR tasks in my build.gradle, the build directory contains only the jar coming from the last jar task overwriting the others.

For example ,

task custom1 (type:Jar) {  
archiveBaseName: ‘custom1’  
}

task custom2 (type:Jar) {  
archiveBaseName: ‘custom2’  
}

the build directory always shows custom2.jar. Is there a way to retain all the produced jars?
