1

I am programming in a mixed Clojure/Java environment. I am using Maven, and some of my dependencies are Clojure libraries from clojars.org.

Now, I need to perform AOT compilation on Clojure code before Java code, since Java code references records defined in Clojure. How can I achieve this using Maven and the clojure-maven-plugin.

myahya
  • 3,079
  • 7
  • 38
  • 51

1 Answers1

0

If a namespace is AOT compiled, all the namespaces it requires or uses will be AOT compiled as well. In Clojure one will usually have a single top level Clojure namespace, in which case it will suffice to AOT compile that namespace. If you call Clojure from Java, it is possible to have multiple top level Clojure namespaces, it's a question of figuring out what they all are and making sure all of them are AOT compiled. Since Clojure does not allow recursive dependencies of any sort, whether a namespace is toplevel is not an ambiguous question; a toplevel namespace is one that is not required or used by any other Clojure namespace.

noisesmith
  • 20,076
  • 2
  • 41
  • 49