Eclipse: Auto-load html/JS changes during debug

2019-09-08 08:09发布

I am running an app in Java Spark Framework. I run it in Eclipse with Debug-As->Java App. This successfully deploys the changes to the Java files. That is, I save a Java file, and Eclipse compiles it, and the running app reflects the changes to the Java file.

Spark uses an embedded Jetty server under the hood, so this is just like running a embedded Jetty app in Eclipse.

Anyone aware of a good way to cause the HTML and JS changes to also be auto-deployed?

1条回答
疯言疯语
2楼-- · 2019-09-08 08:54

In order to auto update the static files of your project, you can reference them as external static files. You're probably doing this:

staticFileLocation("relative-path-to-html-and-js");

Instead of the above, do the following for debug purposes:

externalStaticFileLocation("absolute-path-to-html-and-js");

By doing so, when you press F5 in your browser, you're going to get all your changes to html and js code shown. It's even unnecessary to restart de debugger. Restart the debugger just in case you modified your Java code.

查看更多
登录 后发表回答