I’ve configured my project to use Java Toolchain and am trying to get it to compile in my GitLab CICD environment using the docker runner, however, I’m able to reproduce the issue on my development machine using Docker Desktop as well.
I’ve configured auto-provisioning using the foojay-toolchains plugin in my settings.gradle project as described in the documents and am trying to compile using the eclipse-temurin:11-jdk-alpine
docker image.
The error I’m seeing is this:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':project:compileJava'.
> Could not resolve all dependencies for configuration ':project:compileClasspath'.
> Failed to calculate the value of task ':project:compileJava' property 'javaCompiler'.
> Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=8, vendor=Eclipse Temurin, implementation=vendor-specific} for LINUX on x86_64.
> No matching toolchain could be found in the locally installed toolchains or the configured toolchain download repositories. Some toolchain resolvers had provisioning failures: foojay (Unable to download toolchain matching the requirements ({languageVersion=8, vendor=Eclipse Temurin, implementation=vendor-specific}) from 'https://api.foojay.io/disco/v3.0/ids/ac4c40cdd772fae20f1758b6fd9ac1d6/redirect', due to: Unpacked JDK archive does not contain a Java home: /root/.gradle/.tmp/jdks/OpenJDK8U-jdk_x64_linux_hotspot_8u442b0613882921797832945044.tmp).
I’ve filed a bug report with the foojay project, but it’s looking like it may be more of a gradle issue. I was not able to find any similar bugs or posts for this issue.
Does anyone know what I may be doing wrong or have seen a similar issue?
I am using gradle 8.12 and the toolchain I’m trying to use if Adoptium version 8
I created a sample project that can reproduce the issue I’m seeing GitHub - johnjaylward/gradle-toolchain-error