Join Slack
is there a good way to enforce a certain jdk version for building a gradle project?
# gradle
r
rrva
05/18/2020, 10:03 AM
is there a good way to enforce a certain jdk version for building a gradle project?
a
Arun
05/18/2020, 10:11 AM
This code might be helpful
https://github.com/runningcode/gradle-doctor/blob/master/doctor-plugin/src/main/java/com/osacky/doctor/JavaHomeCheck.kt#L40
n
no
05/18/2020, 2:56 PM
Thanks for the shout out 🙂 That will ensure that your java home is the same, but if you want to ensure that all your builds use java8 you can try this:
https://github.com/gradle/android-cache-fix-gradle-plugin/blob/master/build.gradle#L121
no
05/18/2020, 2:57 PM
@Arun
do you use the gradle doctor in your build? 😄
r
rrva
05/18/2020, 4:35 PM
i’d like to require 11+ or even easier lock it down further
n
no
05/18/2020, 8:05 PM
what are you trying to lock down? out of curiousity?
r
rrva
05/19/2020, 3:55 PM
we import
jdk.jfr
package in our code which is only part of JDK 11+
rrva
05/19/2020, 3:56 PM
and this is not possible to express as a gradle dependency afaik, but its a dependency on JDK internal classes
rrva
05/19/2020, 3:57 PM
so I want to ensure people are guided in the right direction when building. It’s in the README but still
n
no
05/19/2020, 5:11 PM
the sample i sent should be exactly what you need!
3
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by