We can set java_version property in scmCheckout stage like this:
java_version
stage("checkout"){ scmCheckout{ ... java_version = "jdk21" } }