How do I configure my Clojure CLI deps.edn file to compile Java source files along with my .clj Clojure source files?
I found badigeon which can compile Java sources, but I'm struggling to use in my simple project.
How do I configure my Clojure CLI deps.edn file to compile Java source files along with my .clj Clojure source files?
I found badigeon which can compile Java sources, but I'm struggling to use in my simple project.
You can now do that with clojure.tools.build
Without knowing more about your context ...
The "best" way to do this currently, is to separate your Java and Clojure sources into two projects. In the Java project, create a jar with the compiled classes (using standard Java tools - perhaps make and javac) and install the jar into your local maven repo. Then add the jar file as a dependency in the deps.edn of your Clojure project.
You might also be able to use the jar directly, without installing locally, by using the local/root feature in deps.edn. See the Deps Rationale for how to do that.
Another way would be to arrange to have the Java sources compiled into a classes sub-directory of your combined (Java / Clojure) project and then add the classes directory to the :paths key in your deps.edn. The creation of the class files will (again) have to be done with Java tools or shell scripts - outside of clj.
There are some recent developments in clj that may make this easier in the future.