1

I have a JEE project that is purely Java and I have turned it into a Java and Kotlin mixed codebase. I have been using JRebel and when I save a change to a Java class, it is automatically compiled, placed in the project /bin directory as a .class file, and the change is automatically picked up by JRebel and deployed to my running web application.

Now when I save a change to a Kotlin class, it does not get automatically compiled, thus there is no new .class file in the /bin directory and JRebel, therefore does absolutely nothing.

This problem is mentioned in the comments of the JetBrains Kotlin Blog (https://blog.jetbrains.com/kotlin/2015/06/kotlin-eclipse-plugin-0-2-0-2/) and has a ticket in the JetBrains Kotlin tracker (https://youtrack.jetbrains.com/issue/KT-8123 - it has be languishing there for about a year). The Eclipse Kotlin plugin is failing to compile the class file on save for incremental builds. See this related posting: https://stackoverflow.com/a/36259756/2346823

I've found I can trick the Kotlin plugin to create the class file by running a program that uses them - but this is super stinky...

Has anyone figured out how to make the Eclipse Kotlin plugin automatically compile and build the .class file when the source file is saved? Any other hints or tricks would be welcome (other than, "Switch to IntelliJ IDEA")

Thank you.

Yoshiya
  • 452
  • 5
  • 17
  • log a support ticket with the Jrebel guys, they're pretty good – Jan Vladimir Mostert May 26 '17 at 20:31
  • Not really related to JRebel as it's a fault in the kotlin plugin. I guess you can compile the classes externally in the meantime, e.g. `mvn compile` (make sure build tool and eclipse compile to same /bin or /target/classes path) – Murka May 30 '17 at 10:45
  • Right now I have written a Perl script that monitors all Kotlin files for changes, and does a `gradle compileKotlin` when something changes, then looks for updated `.class` files in the `./build/kotlin-classes` directory and copies them into the Eclipse `./bin` directory. It works, but is a stop-gap kludge which I am not proud of.... – Yoshiya May 30 '17 at 12:39

0 Answers0