Multiple versions of Gradle in the same Composite repo

Hi,

I need to use two different versions of gradle to build various parts of my projects. I need to do this to maintain backwards compatibility.
Is there a way to specify which version of gradle to use when building a sub project?

(I know Gradle talks about toolchains and the ability to choose JDKs for sub projects - but I want this capability for Gradle itself).

Any ideas for how to achieve this would be much appreciated.

You cannot.

Even when using a composite build, the included builds always use the Gradle version of the including build and if that build is not compatible with that Gradle version, you are at loss and have to either make it compatible or consider alternatives like publishing to a local direcotry based maven repository.

How you could maybe hack-around it is, if you use the tooling api which is shipped with Gradle anyway. With that you can say “run build X” and it will use that Gradle wrappers defined version or you can also specify a version explicitly in the call. GradleConnector is the entrypoint for this.
But tbh, the question really sounds a bit like you want to do something you really shouldn’t.