# Build a jar for two different target JDK versions?

**URL:** <https://discuss.gradle.org/t/build-a-jar-for-two-different-target-jdk-versions/21044>\
**Category:** Help/Discuss\
**Created:** [January 6, 2017, 6:25pm UTC](https://discuss.gradle.org/t/build-a-jar-for-two-different-target-jdk-versions/21044 "2017-01-06T18:25:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sc1478](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/sc1478/32/4341_2.png) [@sc1478](https://discuss.gradle.org/u/sc1478)\
**Post date:** [January 6, 2017, 6:25pm UTC](https://discuss.gradle.org/t/build-a-jar-for-two-different-target-jdk-versions/21044/1 "2017-01-06T18:25:32Z")

</div>

Suppose I want to build a jar for JDK1.8 and also compile the same code base for JDK1,5 to run on an ancient server we have,without making separate gradle projects. And then suppose I want to publish these jars. Two compile tasks, each feeding a different jar task, etc., etc. My head is starting to spin.

Is there an example of doing this?
