Is there any example somewhere of having gradle download a specific version of java and then use it for the build? I get that gradle requires some version of java to work at all, but it would be nice to have project-specific versions of java that don’t require a specific java location or an env var. Basically, I’d like for any member of the team to be able to clone the project and build as long as they have a java that is capable of running gradle, but I want to control the exact version of java used in the build.
Different versions of our product require different versions of java, and I’d like to be able to put those versions into our internal nexus and download them at the start of the build if they’re not already there, and then use that version of java for the remainder of the build.
I’m on windows and people generally use the plain old command prompt for building, so cygwin/git-bash possibilities like direnv or sdkman seem like non-starters for me. I’m really looking for something where gradle does the work itself.