如何用lein-figwheel编译和导入Java类?

时间:2016-10-05 11:23:14

标签: clojure clojurescript leiningen clojure-java-interop figwheel

我将:java-source-paths ["src/java"]添加到我的project.clj, lein uberjar 可以正常运行但是当运行 lein figwheel 时出现以下错误:

Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid :)
java.lang.ClassNotFoundException: projectc.java.gcloud.DataStore, compiling:(projectc/gcloud/datastore.clj:1:1)

我将此添加到':uberjar`部分

:prep-tasks ["javac" "compile" ["cljsbuild" "once" "min"]]

如何解决这个问题的任何线索?

1 个答案:

答案 0 :(得分:0)

When Figwheel (and the ClojureScript compiler) compiles your code, it will process all clj files that it is given, to compile macros that are in clj files. It looks like Figwheel is trying to compile a file which is using a class which isn't on the Classpath? Is it possible to include that class, or exclude the Clojure file from the Figwheel compilation? Perhaps try building that Java project as a JAR and including it as a dependency as a test?

It's a little hard to tell with not very much information, this issue also looks like it might be relevant?