Search code examples
gradleembedded-jettyspark-java

Autoreload in Jetty with Gradle and Kotlin


Using the Spark web framework I'd like to enable autoreload with the embedded jetty whenever I've compiled files.

Trying

  gradle run -Djetty.reload=automatic -Djetty.scanIntervalSeconds=2

does not work though. Any ideas?


Solution

  • This doesn't work, because you pass this args to gradle jvm, not to jvm which runs Jetty.

    As i see you using Application Plugin so you can pass args via applicationDefaultJvmArgs property:

    applicationDefaultJvmArgs = ["-Djetty.reload=automatic", "-Djetty.scanIntervalSeconds=2"]
    

    Hope this would help.