micrometer icon indicating copy to clipboard operation
micrometer copied to clipboard

Require JDK 11 or 17 for building project

Open shakuzen opened this issue 3 years ago • 2 comments

While we intend to continue supporting JDK 8 compatibility at runtime, we have a build matrix that will continue to get more complicated as more LTS Java releases become available. We recently ran into #3136 where a sample needs JDK 11+ with the latest dependencies. Released artifacts are built with the latest available JDK, but we also have builds for each LTS to ensure the project can be built with older versions. This is a convenience to contributors, but it is becoming more reasonable to require a contributor to have a recent version of the JDK configured for building the project. Using the compiler -release flag, we will ensure API compatibility with JDK 8 while building with newer JDKs.

shakuzen avatar Apr 25 '22 06:04 shakuzen

When we drop JDK 8 or 8/11 builds, we might still want to run tests on those JVMs.

izeye avatar Apr 25 '22 11:04 izeye

When we drop JDK 8 or 8/11 builds, we might still want to run tests on those JVMs.

In order to do that, we will need a build image that has multiple Java versions, which comes with its own complexity. We would probably need to maintain our own custom build image, unless someone is aware of an alternative that doesn't require us to maintain our own.

shakuzen avatar May 13 '22 07:05 shakuzen

We could use the Gradle's toolchain option - I wonder if that can be parameterized. Then we could run it with different parameters like 8, 11, 17 etc. (pseudocode below)

jdkVersion = project.getProperty("jdkVersion") ?: 11

java {
  toolchain {
    languageVersion = JavaLanguageVersion.of(jdkVersion)
  }
}

tasks.withType(JavaCompile) {
  options.release.set(jdkVersion)
}

marcingrzejszczak avatar Dec 27 '23 13:12 marcingrzejszczak