No JDK 16 for Gradle 6

That was an annoying configuration where my project was using JDK 11 but I did not see that my Gradle settings were using JDK 16 and that kept giving me the error:

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:

After I removed JDK 16 from my project, it pointed me to the fact that Gradle had no JDK configured. Hint.

Now that everything is using JDK 11, life is beautiful again in my IDE.

Installing OpenJDK 11 on macOS (again)

I have started to use SDKMan to simplify my life with installing and updating many software that I use regurlarly. Java is one of them. It is the simplest thing to install java with sdk man:

sdk i java 11.0.8.hs-adpt

As simple as that.

I can just use Java 11 from that point on. You can also install Java 8 and switch between both. Convenient when you have to maintain older software.

If I want to update to a new release, I simply have to type:

sdk ug java

Can it really get any easier?

I use the SDKMan on my linux laptop as well and it easily works on both.

I also manage gradle, spring-boot and spark with SDKMan so most of my coding tools are kept up to date with the same tool.

Learning Kotlin by building

It took longer than I want to admit to have a simple Koltin application build this morning. The build.gradle.kts needed a bit of tweaking to get a simple 3 class application with a single test to properly build.

Here is the content of the build.gradle.kts:

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.4.10"
}
dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlin:kotlin-test:1.4.10")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
testImplementation("org.assertj:assertj-core:3.17.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
}
repositories {
mavenCentral()
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "11"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "11"
}