Run gradle build with specific gradle version

Hi there,

I’m trying to upgrade to the latest version of gradle 7.0 (or at least 6.8.3) and I’m looking for ways for developers to try out the latest version of gradle and if they find any problem they can easily revert it to the older version.

Couple options I can see so far:

  1. use ./gradlew wrapper --gradle-version 7.0 then run Gradle build, to revert it just run ./gradlew wrapper --gradle-version 6.3. This might create some modified git version control (one of gradlew, gradle-wrapper.properties, etc…) and developers might accidentally check it in

  2. use something similar to gradle-profile → GitHub - gradle/gradle-profiler: A tool for gathering profiling and benchmarking information for Gradle builds (not exactly sure how to do this with my current multiple projects)

Any thoughts/comments would be great appreciated.
Cheers,
Tony

You can just not use the gradle wrapper, but use some installed or provisioned Gradle installation directly.
For this you can for example use some tool like SDKMAN, or you should also be able to use one of the wrapper provisioned versions at ~/.gradle/wrapper/dists/ directly.

@Vampire thanks for your suggestion on SDKMAN, and can you elaborate more on how can I use the wrapper provisioned versions at ~/.gradle/wrapper/dists directly?

Just do it? In there are the full distributions.

sorry, I were confused and not sure how to do it
as I can’t use ./gradlew myTask because it would still use the old version of gradle distribution

I did run ./gradlew wrapper --distribution-type=ALL --gradle-version=6.8.3 , so I’m pretty sure it has the version I want to experiment with.

Are you saying there’s command line like ./gradlew --use-version 6.8.3 myTask and it would use the 6.8.3 of gradle eventhough my gradle-wrapper.properties currently using 6.3

Thanks,
Tony

Yes, just use a gradle of the intended version instead of gradlew. If you don’t use the wrapper, the wrapper properties are not significant.

thanks @Vampire , that gives us flexibility in try out the newer version of gradle with wider audience