title: How to enable Java 12 preview features with Gradle?
body: <p>When I tried to build my Java code which has <a href="https://openjdk.java.net/jeps/354" rel="noreferrer">switch expressions</a> using Gradle, it throws this error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error: switch expressions are a preview feature and are disabled by default.
  </code></pre>
  
  <p>I tried running <code>./gradlew build --enable-preview</code> which didn't work either.</p>
  
  <p>I'm using Gradle 5.3.1.</p>