lein uberjar not creating class files with :aot

328 views
Skip to first unread message

Shoeb Bhinderwala

unread,
Jan 3, 2015, 2:39:30 PM1/3/15
to clo...@googlegroups.com
When I create a uberjar with aot compilation I am surprised to see ".clj" files in there. Then when I run the jar with the "java -jar myuberjar" command I get a ClassNotFoundException.

For example, I am have the following dependency in my project.clj file:

                 [org.clojure/java.jdbc "0.3.6"]

However, when running the uberjar I see the following exception

   java.lang.ClassNotFoundException: clojure.java.jdbc.Connectable

Inside the uberjar when I traverse to the location \clojure\java\jdbc I see only one file "jdbc.clj" and no ".class" files? I don't see the Connectable.class file there.  I am expecting to see the .class files here as I am specifying :aot :all in my project.clj file:

  :profiles
    {:dev   {:resource-paths ["config_dev"]}
     :stage {:resource-paths ["config_stage"]}
     :prod  {:resource-paths ["config_prod"]}
     :uberjar {:aot :all}})

Have spent many hours hair pulling but not able to figure out how to solve this problem.

Many thanks for your help.
Regards,
Shoeb

Leiningen version 2.5.0
Java version 1.7
Issue is on both Windows 7 and Linux.

Michael Blume

unread,
Jan 3, 2015, 3:43:43 PM1/3/15
to clo...@googlegroups.com
it's hard to say exactly what's going on without tinkering with your project, but Connectable is found in the clojure.java.jdbc, so I'd make absolutely sure that namespace has been required before Connectable is referred to. And then, well, if it were me, I'd just ditch AOT. In my experience it causes more problems than it solves.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Blume

unread,
Jan 3, 2015, 3:44:36 PM1/3/15
to clo...@googlegroups.com
(in the clojure.java.jdbc namespace, I should have said)


For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

Shantanu Kumar

unread,
Jan 4, 2015, 4:27:52 AM1/4/15
to clo...@googlegroups.com
I have run into this (using lein 2.5.0 and 2.4.1) as well. `lein uberjar` seems to wipe out the pre-generated classes when creating an uberjar.

Shantanu
Reply all
Reply to author
Forward
0 new messages