leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
2020-06-11T23:25:31.244800Z

would anyone like to help prevent a suicide? I need some help generating a functioning uberjar.

2020-06-11T23:33:30.245Z

for future reference, you're more likely to get help if you describe the problem - what exactly goes wrong?

2020-06-11T23:38:36.245200Z

thanks, I have a dependency on a project that has a custom java component. eveyrthing is working fine via lein run, however if I attempt to generate an uberjar and run it. It complains;

java -jar target/uberjar/tickfest-0.1.0-SNAPSHOT-standalone.jar
Exception in thread "main" java.lang.NoClassDefFoundError: qwrap/core/qDict (wrong name: qwrap/core/QDict)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)

2020-06-11T23:39:37.245400Z

do you define a class called qDict with the q lower case?

2020-06-11T23:40:42.245600Z

or perhaps use deftype or defrecord to create something called qDict?

2020-06-11T23:40:42.245800Z

the author of the dependency defines a record, yes <https://github.com/echou/qwrap-clj/search?q=qDict&amp;unscoped_q=qDict>

2020-06-11T23:41:19.246Z

yeah, the normal solution would be to name it as expected - with the first letter capitalized

2020-06-11T23:42:08.246200Z

why does it work fine under lein run ?

2020-06-11T23:42:12.246400Z

alternatively you can avoid aot (using clojure.main as your entry point, not using gen-class), which causes the class to be loaded the same way it would when using lein run

2020-06-11T23:42:30.246600Z

because class files from a resource are not defined the same way as ones created in memory by clojure

2020-06-11T23:43:16.246800Z

when you do (defrecord Foo ...) in clojure, clojure directly compiles the byte code for a class Foo and injects it into the vm, this is not the same as looking up a class in a jar, and clojure is less picky about things like naming conventions

2020-06-11T23:44:03.247Z

so you can have names that work without aot, and break with aot, if you don't follow the java naming rules

2020-06-11T23:44:07.247200Z

I see, great catch -- I didn't even notice the case difference in the error.

2020-06-11T23:44:37.247500Z

I'll try a simple rename in my fork of the repo and see if that helps

2020-06-11T23:47:04.247700Z

thanks a lot for your help