Hey folks! What are the (FOSS?) options I have for...
# server
m
Hey folks! What are the (FOSS?) options I have for enabling hot reloading in kotlin/ktor app?
h
I don't know (haven't tried it), but I think that https://github.com/HotswapProjects/HotswapAgent is the only FOSS hot reload on the JVM anyway?
m
Ah, thanks. I'll check it out
Please what about code formatting on save (this is IDE specific I guess)?
@hho So I tried using the hotswap agent lib but I'm faced with errors. I followed the documentation here: http://hotswapagent.org/mydoc_quickstart-jdk17.html and got some help from AI. This happens when I try to start the app with the VM options as in the docs.
h
You're starting
/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java
which is probably the OpenJDK 11 from your distribution, not the JetBrains Runtime 17 from the Quickstart. And OpenJDK 11 doesn't have the
-XX:AllowEnhancedClassRedefinition
parameter, so the JVM doesn't start.
m
tbh, I think I also tried with jdk 17, I'd try again
Same error with jdk 17
c
We do not use Ktor, but hot reloading just works for us in IntelliJ when in debug mode. There is a bit on configuring that's explained here: https://github.com/codeborne/replay#development-flow-hot-swapping
m
If I understand correctly, the hot reload is enforced at the jvm level?
Also, does this only work for IntelliJ?
c
What I just suggested: I guess yes, only intelliJ.
👍 1
I dont know what you mean by enfoced.
m
I mean, the hot reload plugin is not limited to any particular jvm-based framework, and is more like a wrapper over the main jvm?
c
I'm explaining you a way without a plugin.
I tryied that plugin years ago and did not get it to work, nor do i know how ti works.
We use IntelliJ's way of CTRL-SHIFT-F9'ing code into a locally debug-running app. That's all I can tell you.
m
I see.. I'm looking at it now
I'm trying to follow this section of the README: https://github.com/codeborne/replay#development-flow-hot-swapping.
It looks like I have to run my app inside the replay repo?
Since it says I should open the folder in IntelliJ
c
In the link I sent you, only step3 is what you should try to get it to work (and you need a proper run config as explain but you probably have one already: debug runs need to work)
h
Your OpenJDK 17 also doesn't seem to be the JetBrains Runtime mentioned in the Quickstart
m
@Cies So I don't have to clone the repo?
@hho how so? I'm using the quick start for JDK 17
c
No, do not clone the repo. It just explain how to achieve it IFF you'd have cloned the repo. See step 3 (as I mentioned) and make sure you have a run config in Intellij by which you can start the app locally in debug mode. Or clone the repo and determine that you can do it in an example project. The linked bit of documentation explains the limits of this approach.
m
By "run config" you mean the details highlighted in step 5?
c
Yes. 4&5 and the text below. It's a common thing in Intellij.
m
But I guess I'm not meant to use same details
How do I identify mine?
for instance, "criminals.main" would map to what exactly?
c
Sorry I'm not going to help further.
Too busy.
m
Yikes, that's okay. Thanks for your time
Just got it to work. Apparently the run config was already set :)
Looks good so far. Thank you
c
Welcome
m
So it seems this isn't a plugin but like a built-in solution in Intelli J?
c
As i said in my first post in this thread: "We do not use Ktor, but hot reloading just works for us in IntelliJ when in debug mode."
👍 1