# Change files before Building

**URL:** <https://discuss.gradle.org/t/change-files-before-building/34927>\
**Category:** Help/Discuss\
**Created:** [February 14, 2020, 10:57pm UTC](https://discuss.gradle.org/t/change-files-before-building/34927 "2020-02-14T22:57:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeFoe](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@JoeFoe](https://discuss.gradle.org/u/JoeFoe)\
**Post date:** [February 14, 2020, 10:57pm UTC](https://discuss.gradle.org/t/change-files-before-building/34927/1 "2020-02-14T22:57:52Z")

</div>

Hello ,

Newbie to Gradle

I have a class library that is being built using different jdk versions (Basically 1.8 and 11) and Different versions of an application.

e.g `./gradlew build -Pparameterx="Software1" -Dorg.jdk.home="pathtojdk"`  
` ./gradlew build -Pparameterx="Software2" -Dorg.jdk.home="pathtojdk"`

This was working until a new version of the software changed an API and hence one class has to be modified to take that change into account. It’s just one line change  
e.g

Previous Versions

```gradle
ClassA classa = new ClassA();
classa.doAction();

```

New Version

```gradle
ClassANew classa = new ClassANew();
classa.getNewAction().doAction();

```

So my question is

If i want to keep building for all versions then i only have to change these two lines and then i will have jars available for all versions.

Basically what i want is keep two copies of the class (the one that has changed) and overwrite the old version with the new version and build.

Is this even possible? is this the right way?

Thanks!

---

<div class="post-metadata">

**Author:** ![jjustinic](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jjustinic/32/9005_2.png) [@jjustinic](https://discuss.gradle.org/u/jjustinic)\
**Post date:** [February 15, 2020, 2:17am UTC](https://discuss.gradle.org/t/change-files-before-building/34927/2 "2020-02-15T02:17:41Z")

</div>

This sounds like a good case for using @Lance’s [Java Flavours Plugin](https://github.com/uklance/gradle-java-flavours#gradle-java-flavours--). Your common code will stay in the same place, but you’ll create a “flavour” for the old and new versions, which will allow you to have a different version of the class in each one and a different version of the dependency.
