Hey all :wave: - new to ktor and kotlin. Struggli...
# ktor
j
Hey all 👋 - new to ktor and kotlin. Struggling to find a way to run a REPL that has my ktor (really
build.gradle.kts
I suppose) environment loaded. Also open to someone giving me a slap and explaining why this is not a necessary/useful part of your workflow (I'm coming from Rails/Phoenix worlds where this is commonplace).
m
Can you share any errors you're getting? I don't find the REPL useful since it's so easy to write tests that hit your app's endpoints: https://ktor.io/servers/testing.html. If I get something working, I'd rather have a test that documents it and keeps it working than a REPL history. 🤷
j
Sure, and that's what I'm doing too. I'd just like the REPL as a learning tool, playing around with things while I'm trying to find my way. Here's one I tried https://gist.github.com/mkobit/e06ddf93fcb9a67ded3426bd5a266bed - now, I'm very early days of learning all this, so I just copy/pasted and tried it. First I got "Unresolved reference" for
java.sourceSets
, so just copying other lines in my
build.gradle.kts
file I removed the
java.
, next run it went further but I got
Exception in thread "main" java.lang.NoClassDefFoundError: gnu/trove/THashMap
- at which point I gave up :)
I also tried to get https://github.com/h0tk3y/gradle-kotlin-repl working, but I'm guessing he hasn't actually published the lib anywhere? I tried a few options to get it to install but gradle just couldn't find it.