Running into a new problem trying to run some unit...
# announcements
d
Running into a new problem trying to run some unit tests with Kotlin. I’m making a change to a class in my main code set and when i rerun the test, it is not detecting the changes and is giving me the same error I had before the change. Even adding a println just before that line and now the error points to the printlin. I’m running the tests in IntelliJ. Anyone else run into this?
I just restarted IntelliJ to be sure it’s not just a glitch but alas it is still happening
It’s like IntelliJ isn’t bothering to recompile the kotlin files
r
Something’s cached and not being recompiled
a
Invalidate Caches and restart Intellij from the "Files" Menu
🆗 1
d
Alright, I’ve done that and it is still not recognizing the changes.
I tried deleting the problematic .class file and now it’s not even bothering to recompile it for the test so I’m getting NoClassDefFoundError
I deleted the target dir and tried rerunning the test. It looks like it is not compiling the main src without running
mvn compile
manually.
Anyone else have any thoughts on this? Really at a loss here.
h
Do you have "Build" in the "Before launch" list of your run configuration?
s
This always worked for me, but it is still a workaround if changes in your test-code are not picked up: Instead of picking a test class or test package pick a test method (right click on one of your test-methods and hit run-test or debug-test). This seems to always compile the test-sources. Note that I had issues with changes in my test-sources. I never had issues with changes in my actual/main sources. These changes were always picked up when running the test(s) again.
d
@hho yes
@streetsofboston just tried that to no avail
h
Have you tried reimporting your Maven projects? Maybe some paths are wrong?
d
Yeah, I’ve tried that
I guess my IntelliJ is just freaking out… Done a few things now and all of a sudden it has unmarked all of the src/main/java directories as source roots
Seemed to be the result of the last invalidate&restart
Oddly it wasn’t all of them… just most