https://kotlinlang.org logo
#ktor
Title
g

gcole

12/06/2018, 3:12 AM
I would like to rig my dev environment to do auto reload, but i must be missing something. In my resources/application.conf file I added content:
Copy code
ktor {
    deployment {
        environment = development
        port = 8080
        autoreload = true
        watch = [ org/grcole/bfw ]
    }

    application {
        modules = [ org.grcole.bfw.BFWApplicationKt.main ]
    }
}
but when I run it, it tells me there are no watched locations:
Copy code
[grcole@C02WP0CRHTDG bfw (master)]$ ./gradlew :run

> Task :run
2018-12-05 19:04:49.865 [main] INFO  Application - No ktor.deployment.watch patterns match classpath entries, automatic reload is not active
2018-12-05 19:04:50.295 [main] INFO  Application - Responding at <http://0.0.0.0:8080>
Is there a 'best practice link' for env setup for a noob?
s

samir

12/08/2018, 1:20 PM
@gcole Were you able to get it to work? I am having the same issue
g

gcole

12/12/2018, 2:12 AM
No 😞, I've been working on something else and was hoping by the time I came back to this there would be some ideas. I'm still not able to get it to work.
s

samir

12/15/2018, 11:21 AM
Ok if you ever get it to work I would appreciate it if you could share what you changed. I’ve been struggling with this for month and the documentation on the ktor didn’t help much
d

Danilo Herrera

12/18/2018, 12:48 AM
Hey guys, just encountered the same issue. I got it to work with the following: 1. Ensure you're watching the class changes in the application.conf file (for me it was my project's directory):
Copy code
deployment {
        port = 8080
        port = ${?PORT}
        watch = [ MyFirstProject ]
    }
This only watches the class changes, therefore the project will need to recompiled, thus requiring: 2. Run
gradle -t build
to recompile when there are changes. 3. In a separate terminal tab, run
gradle run
. Unfortunately, the auto reload didn't work when I ran the application via IntelliJ as opposed to the terminal. After following these steps, every time I made a change in IntelliJ I would switch to the browser and the change would be reflected after refreshing (often had to refresh two or three times while the project recompiled). If anyone finds a better way, please let us know 🙂
2 Views