You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was getting byzantine errors when trying to (:import) a java class we had in our :java-source-paths in the project.clj, saying it wouldn't import. It turns out, that by having a reference to the core NS causes some form of dependency chain that makes the java file fail to be compiled and imported.
See here, here and here for a sample of such errors.
The solution for us was to remove the reference to the core ns, and remove the REPL server definition there (so we don't need to except it in the (start) and (stop) functions). We added a new (init) fn which did require that NS, making the start and stop work again.
Possibly there are cleaner ways of solving it, but the current template is broken as soon as you want to import local java files.
The text was updated successfully, but these errors were encountered:
I wonder if it might be better to document the issue. I personally favor the approach of compiling Java sources in a separate profile. The approach James Reeves mentions with using a dev.clj to bootstrap the user namespace is also an option, but that creates an extra step for the development process and it doesn't appear that this is a common situation.
Not sure how/if compiling Java sources in a separate profile effects things?
Can you expand? I wouldn't mind trying it out. The main requirement is that I need to emit a protobuf encoded object as part of a handling function (and protoc generates Java files).
Also, there may be a way to automate the init with :init-ns etc, as Weavesjester mentioned in the /r/Clojure topic.
I was getting byzantine errors when trying to (:import) a java class we had in our :java-source-paths in the project.clj, saying it wouldn't import. It turns out, that by having a reference to the
core
NS causes some form of dependency chain that makes the java file fail to be compiled and imported.See here, here and here for a sample of such errors.
The solution for us was to remove the reference to the core ns, and remove the REPL server definition there (so we don't need to except it in the
(start)
and(stop)
functions). We added a new(init)
fn which did require that NS, making the start and stop work again.Possibly there are cleaner ways of solving it, but the current template is broken as soon as you want to import local java files.
The text was updated successfully, but these errors were encountered: