junit-team / junit5

✅ The 5th major version of the programmer-friendly testing framework for Java and the JVM
https://junit.org
Eclipse Public License 2.0
6.43k stars 1.5k forks source link

Gradle toolchain cannot automatically download JDK 8 for aarch64 on macOS #3058

Closed raddatzk closed 2 years ago

raddatzk commented 2 years ago

I am using the current main branch on commit 4a87980a

Steps to reproduce

Take an Apple Silicon Device and try ./gradlew clean assemble, it will produce the following output:

╰$ ./gradlew clean assemble        

Welcome to Gradle 7.5.1!

Here are the highlights of this release:
 - Support for Java 18
 - Support for building with Groovy 4
 - Much more responsive continuous builds
 - Improved diagnostics for dependency resolution

For more details see https://docs.gradle.org/7.5.1/release-notes.html

Type-safe project accessors is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':junit-platform-console-standalone:jar'.
> Could not resolve all dependencies for configuration ':junit-platform-console-standalone:shadowed'.
   > Failed to query the value of task ':junit-vintage-engine:compileTestFixturesGroovy' property 'javaLauncher'.
      > Unable to download toolchain matching these requirements: {languageVersion=8, vendor=any, implementation=vendor-specific}
         > Unable to download toolchain. This might indicate that the combination (version, architecture, release/early access, ...) for the requested JDK is not available.
            > Could not read 'https://api.adoptium.net/v3/binary/latest/8/ga/mac/aarch64/jdk/hotspot/normal/eclipse' as it does not exist.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
12 actionable tasks: 12 up-to-date

A build scan was not published as you have not authenticated with server 'ge.junit.org'.
For more information, please see https://gradle.com/help/gradle-authenticating-with-gradle-enterprise.

Seems like spotbugs is trying to get aarch64 version of jdk8, but this is not available. Would it be possible to set the platform to amd64?

Context

sbrannen commented 2 years ago

Adoptium only offers x64 for Java 8 and macOS, which means that Gradle's toolchain support cannot automatically download an appropriate JDK 8 for you.

So you have to manually download and install an aarch64 compatible JDK 8 for macOS for the build to work.

I got this from Zulu, and it works fine.

openjdk version "1.8.0_342"
OpenJDK Runtime Environment (Zulu 8.64.0.15-CA-macos-aarch64) (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (Zulu 8.64.0.15-CA-macos-aarch64) (build 25.342-b07, mixed mode)
sbrannen commented 2 years ago

Leaving this ticket open for the time being, since we should update the README to reflect this.

marcphilipp commented 2 years ago

FWIW There are plans for Gradle to support using the foojay Disco API instead of the one from Adoptium which will allow provisioning aarch64-compatible JDKs automatically.

marcphilipp commented 2 years ago

Leaving this ticket open for the time being, since we should update the README to reflect this.