I've a multi module maven project, where one of the modules have both java and clojure code, clojure code requires a pojo from java source and another class in java source require clojure compiled code (I've added :gen-class and project compiles well even though it gave an error initially as failed to see java class I when clojure-maven-plugin and compiles do a clojure:compile and compile). But this is not working from the outer pom where it manages the multi modules. Appreciate any help on finding a solution
As one of the comments said, clojure-maven-plugin cannot handle circular dependencies between Java and Clojure code in the same module. Java code is compiled before Clojure code.
But you could restructure the code to eliminate circular dependencies. Split the Java + Clojure project (maven module) into three:
The Base Java module would at least include the POJO that the Clojure module needs and possibly other common things. The Clojure module would contain all the Clojure code, and the 2nd Java module would contain the part of Java code that requires a class that is generated by the Clojure compiler. Only the Clojure modules requires the clojure-maven-plugin.
You could then setup dependencies between those modules, such that:
As long as the AOT compilation is setup properly in the Clojure module, everything should now compile. I believe clojure-maven-plugin AOT-compiles all namespaces by default. Without the AOT compilation, (gen-class)
does nothing.