Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies classpath isn't handled? #2

Closed
berdario opened this issue Apr 15, 2015 · 2 comments
Closed

Dependencies classpath isn't handled? #2

berdario opened this issue Apr 15, 2015 · 2 comments

Comments

@berdario
Copy link

Hi, I'm trying out Frege, and defining a simple hello world module that uses a Java library:

https://gist.github.com/berdario/402d529b1874d4afd04b

Unfortunately, lein fregec fails with:

dario@curie ~/P/s/f/helloproject (master#)> lein fregec
E /home/dario/Projects/snippets/frege/helloproject/src/Hello.fr:3: `org.joda.time.Years` is not a known java class
Hello: build failed because of compilation errors.
Build failed.
Frege compilation failed!
Subprocess failed

Similarly, lein uberjar:

Warning: specified :main without including it in :aot. 
Implicit AOT of :main will be removed in Leiningen 3.0.0. 
If you only need AOT for your uberjar, consider adding :aot :all into your
:uberjar profile instead.
E /home/dario/Projects/snippets/frege/helloproject/src/Hello.fr:3:`org.joda.time.Years` is not a known java class
Hello: build failed because of compilation errors.
Build failed.
Frege compilation failed!
Uberjar aborting because jar failed: Subprocess failed

If I uncomment line 11 in the project.clj, both operations work, or also if I invoke fregec with lein fregec :fp ~/.m2/repository/joda-time/joda-time/2.7/joda-time-2.7.jar

Still, lein fregec :fp ~/.m2/repository/joda-time/joda-time/2.7/joda-time-2.7.jar :run Hello will fail with

    at clojure.lang.Compiler.load(Compiler.java:7142)
    at clojure.lang.Compiler.loadFile(Compiler.java:7086)
    at clojure.main$load_script.invoke(main.clj:274)
    at clojure.main$init_opt.invoke(main.clj:279)
    at clojure.main$initialize.invoke(main.clj:307)
    at clojure.main$null_opt.invoke(main.clj:342)
    at clojure.main$main.doInvoke(main.clj:420)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at user$eval3.invoke(form-init7777763093074268137.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6703)
    at clojure.lang.Compiler.load(Compiler.java:7130)
    ... 11 more
Caused by: java.lang.NoClassDefFoundError: org/joda/time/Years
    at Hello$1$1.eval(Hello.java:139)
    at frege.runtime.Delayed.call(Delayed.java:198)
    at frege.runtime.Delayed.forced(Delayed.java:257)
    at Hello$IJ$getYearsƒ2c78b3e0.eval(Hello.java:161)
    at Hello$IJ$getYearsƒ2c78b3e0.eval(Hello.java:158)
    at frege.runtime.Fun1$1.eval(Fun1.java:63)
    at frege.runtime.Delayed.call(Delayed.java:200)
    at frege.runtime.Delayed.forced(Delayed.java:257)
    at Hello$IJ$printlnƒcfbbb639.eval(Hello.java:178)
    at Hello$IJ$printlnƒcfbbb639.eval(Hello.java:172)
    at frege.runtime.Fun1$1.eval(Fun1.java:63)
    at frege.runtime.Delayed.call(Delayed.java:198)
    at frege.runtime.Delayed.forced(Delayed.java:257)
    at Hello._main(Hello.java:130)
    at Hello$IJ$_mainƒ80d26b67.eval(Hello.java:168)
    at Hello$IJ$_mainƒ80d26b67.eval(Hello.java:165)
    at frege.runtime.Fun1$1.eval(Fun1.java:63)
    at frege.runtime.Delayed.call(Delayed.java:198)
    at frege.runtime.Delayed.forced(Delayed.java:267)
    at Hello.main(Hello.java:187)
    ... 18 more
Caused by: java.lang.ClassNotFoundException: org.joda.time.Years
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 38 more
Subprocess failed

While the uberjar isn't quite an uberjar, since I have to supply the Joda dependency manually in the classpath:

java -cp /home/dario/.m2/repository/joda-time/joda-time/2.7/joda-time-2.7.jar:target/example-0.1.0-SNAPSHOT-standalone.jar Hello

Is this expected behavior and are these simply features yet-to-be-implemented?

Thank you

@seancorfield
Copy link
Contributor

You have the Joda Time dependency in the wrong place -- under :plugins. It needs to be under :dependencies.

@berdario
Copy link
Author

Uhhhh... Thanks, it works perfectly!

And sorry -_- some days I tend to overlook stuff that should stick out quite obviously :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants