Repeatable builds with Toolchains for JVM projects

Gradle version 7.6.1

Hi all,

We are experimenting with Toolchains for JVM projects. We want to use auto-provisioning but we are also interested in ensuring repeatable builds.

At present it seems that it is only possible to specify the major version number of the Java Language Version e.g

languageVersion = JavaLanguageVersion.of(17)

With subsequent precedence rules deciding on the eventual match.

I am interested to know whether it is possible to ensure that an exact match is used?

For example, if I have provisioned 17.1.0 and 17.2.0 but I want to for the toolchain to use 17.1.0, even though the later minor version 17.2.0 will be selected by precedence rule, is this possible?

Thanks in advance

Simon

Afair, only if you either run Gradle with the 17.1.0 one because afair the toolchain running Gradle will always be preferred if it matches the spec.

Other than that, you would probably have to disable discovering toolchains and instead supply the ones you want to be used using environment variables.

1 Like

Thanks once again for your quick, good advice. @Vampire. I think that you have answered every post I have made on this forum and I really appreciate your time.

1 Like

I’m happy I could help :slight_smile:

1 Like