title: How to auto-reload/hotswap with gradle and scala?
body: <p>I have a Scala server application that uses gradle and <a href="https://docs.gradle.org/current/userguide/scala_plugin.html" rel="nofollow noreferrer">scala</a> and <a href="https://docs.gradle.org/current/userguide/application_plugin.html" rel="nofollow noreferrer">application</a> plugins for build and running. I start the application with <code>gradle run</code>.</p>
  
  <p>A part of my gradle. A typical one, really:</p>
  
  <pre><code>...
  apply plugin: 'scala'
  apply plugin: 'application'
  ...
  mainClassName = "mypackage.Main"
  </code></pre>
  
  <p><strong>How to automatically re-compile and restart the application whenever I modify the source code?</strong><br>
  Preferably, using the CLI and gradle without any IDE usage. Also, I've heard a similar feature is in sbt, but I'm not intending to use sbt.</p>