One of my project requires Java 1.8, but sometimes we didn't notice we are using older java so that we will get some strange errors.
I want to add the checking in build.gradle
, so that when we run any task, it will firstly check the version, and prints error and quit immediately.
I tried to add the checking directly in build.gradle
on the first line, but it still do some others tasks e.g. (clean
, compileJava
) before the checking happens, when I run:
$ ./gradlew
How to do it correctly?