Fork me on GitHub

Hi, having issues importing java classes (generated by protobuf) from another folder in the monorepo using deps.edn . I've tried both adding the paths to :paths of my project and creating a deps.edn in the protos folder and adding that as a local dep. In both cases the classpath shows up when doing clj -Spath but starting a repl fails with ClassNotFoundException


@afhammad have you tried {:local/root "/path/to/java/classes"} ? I used this to import java sources into a deps.edn project, using an alias, e.g. Perhaps that will work for classes too, as it add them onto the classpath.


@jr0cket does it have to be a zip? It's currently a folder with .java files. This worked using boot's :source-paths

Alex Miller (Clojure team)13:04:43

If you have Java files, you need to javac compile them into classes

Alex Miller (Clojure team)13:04:50

If you have classes, what you say above should work, but make sure the classes are in a directory structure that matches their package name (just like Clojure source)


Thanks @alexmiller. Precompiling worked. Is there a nice way of doing it as part of the deps.edn setup? One reason is it requires passing in a .jar dependency in order to compile which is already a dep of the project, but having the javac compilation as a separate step means I have to worry about fetching that dependency myself.

Alex Miller (Clojure team)19:04:57

it will always be an extra step, but there are some helper dep tools out there to do that

Alex Miller (Clojure team)19:04:29

one option is to portion the java stuff into its own project that you can build (with mvn or something else), deploy it, and depend on it


yeh, thats one way to go, thanks