title: How to check java version when running gradle?
body: <p>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.</p>
  
  <p>I want to add the checking in <code>build.gradle</code>, so that when we run any task, it will firstly check the version, and prints error and quit immediately.</p>
  
  <p>I tried to add the checking directly in <code>build.gradle</code> on the first line, but it still do some others tasks e.g. (<code>clean</code>, <code>compileJava</code>) before the checking happens, when I run:</p>
  
  <pre><code>$ ./gradlew
  </code></pre>
  
  <p>How to do it correctly?</p>