Reputation: 1411
According to the README of clj-facebook-graph:
Installation
This project is built with Leiningen and prepared for use with Swank Clojure. Pay attention that on first-time use you have to invoke "lein compile" to compile the clj_facebook_graph.FacebookGraphException ahead-of-time, otherwise you will get a ClassNotFoundException for this class.
My question is, how does one do this said "ahead-of-time" compilation.
By the way, I tried running lein compile
on the said library but I get the following error:
[WARNING] POM for 'org.apache.httpcomponents:httpcore:pom:4.1.2:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[WARNING] POM for 'commons-logging:commons-logging:pom:1.1.1:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
Copying 14 files to /root/clojure/clj-facebook-graph/lib
Copying 20 files to /root/clojure/clj-facebook-graph/lib/dev
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5441)
at clojure.lang.Compiler.eval(Compiler.java:5392)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at clojure.lang.LazySeq.sval(LazySeq.java:47)
at clojure.lang.LazySeq.seq(LazySeq.java:56)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:560)
at clojure.core$next.invoke(core.clj:61)
at leiningen.deps$extract_native_deps.invoke(deps.clj:174)
at leiningen.deps$deps.doInvoke(deps.clj:200)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at leiningen.compile$prep.invoke(compile.clj:150)
at leiningen.compile$eval_in_project.doInvoke(compile.clj:207)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at leiningen.compile$compile.invoke(compile.clj:283)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:262)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval73.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
... 11 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.jar.JarFile.<init>(JarFile.java:154)
at java.util.jar.JarFile.<init>(JarFile.java:118)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at clojure.lang.Reflector.invokeConstructor(Reflector.java:160)
at leiningen.deps$extract_native_deps$fn__2488.invoke(deps.clj:174)
at clojure.core$map$fn__3699.invoke(core.clj:2096)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
... 35 more
Upvotes: 1
Views: 455
Reputation: 321
To achieve aot compilation with leiningen, you should only have to add :aot :all
at the top-level of your project.clj
or in the relevant profile if you prefer.
You can even compile aot only the namespaces of your choice.
See this project.clj
sample: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L242
I've compiled aot and uberjar'ed a lein project depending on this library countless times.
I know that clj-facebook-graph
is pretty old and not actively maintained (ex: they're talking about swank-clojure
while swank-clojure
has been superseeded by NRepl a long time ago.)
Hope that helps
Upvotes: 1