Ktor: autoreload doesn't work for classnames

Created on 19 Feb 2017  路  3Comments  路  Source: ktorio/ktor

The wiki page says "For now watch keys are just strings that are matched with contains against path to classes/jars of the loaded application." To me, that wording suggests I could use the pathname of a class or a package.

If I try to watch using a substring from a package name (eg "web" from org.example.web), it doesn't work (unless that substring happens to be part of the classpath entry), with this misleading warning:

Application.Loader - No ktor.deployment.watch patterns specified: hot reload is disabled

I think this would be clearer (in the wiki):
"For now watch keys are just substrings that are matched with contains against classpath entries of the loaded application, such as a jar name or a project directory name."

Most helpful comment

@jiaweizhang by "project directory name" I meant the name of the directory which contains your project source code.

For instance, if you have a package called com.hello, it might be part of a project called greeting, so perhaps the project directory name is /home/user/projects/greeting, and the classpath entry might be something like /home/user/projects/greeting/target/classes or /home/user/projects/greeting/target/greeting-1.0-SNAPSHOT.jar (assuming Maven, and depending how you are executing the code).

So in such a case, you would need to use a key like "greeting", not "hello" or "com.hello". (I guess "target" might work too, but I haven't tried it.)

All 3 comments

Improved diagnostics in ktor itself and updated docs as suggested

@seanf What does "project directory name" in your wiki clarification mean? Could you provide an example?

I also received this message when I tried to watch [ hello, com.hello]

No ktor.deployment.watch patterns specified: hot reload is disabled

Not sure how project directory name is related to classpath entries. Thanks

@jiaweizhang by "project directory name" I meant the name of the directory which contains your project source code.

For instance, if you have a package called com.hello, it might be part of a project called greeting, so perhaps the project directory name is /home/user/projects/greeting, and the classpath entry might be something like /home/user/projects/greeting/target/classes or /home/user/projects/greeting/target/greeting-1.0-SNAPSHOT.jar (assuming Maven, and depending how you are executing the code).

So in such a case, you would need to use a key like "greeting", not "hello" or "com.hello". (I guess "target" might work too, but I haven't tried it.)

Was this page helpful?
0 / 5 - 0 ratings