How do I recompile and reload Java source code while `lein repl` is running?

前端 未结 5 1128
[愿得一人]
[愿得一人] 2021-01-31 12:07

I have a Clojure project, and I\'m using leiningen. I\'m also using tools.namespace to reload Clojure code while running a REPL. If I want to include Java source in the project,

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 12:34

    Spring-loaded or JRebel might be what you want. Have a look at https://github.com/spring-projects/Spring-loaded or http://zeroturnaround.com/software/jrebel/. They both provide an agent monitoring the filesystem for class file changes and update class definitions in the running JVM. I personally use Spring-loaded, but not yet together with tools.namespace. I guess the key to run them both is to make sure they do not conflict. So if you use Spring-loaded, it should be the only tool tracking class files and you better not use aot at all. If I remember correctly, tools.namespace discourages the use of aot anyways.

提交回复
热议问题