Do Java Libraries work with `deps.edn`?

I’ve tried to read all the tutorials and I’m hitting some weird issue migrating to deps.edn
It seems to work fine with clojure libraries from Clojars - but I can’t seem to link a Java library

The clojure tool clj also doesn’t throw any errors or have sufficient diagnostics (from all the flags I’ve tried) to pinpoint whats going on

I started with a lein project that looked like:

(defproject cameba "0.1.0-SNAPSHOT"
  :description "my personal playground for messing with microphone input"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [cljfx "1.3.5"]
                 [com.github.afester.javafx/FranzXaver "0.1"]
                 [thi.ng/geom-viz "0.0.908"]]
  :main ^:skip-aot cameba.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

So then I wrote

{:deps
 {cljfx {:mvn/version "1.4.1"}}
 {com.github.afester.javafx/FranzXaver {:mvn/version "0.1"}}
 {thi.ng/geom-viz {:mvn/version "0.0.908"}}}

The second library (A Java library) isn’t showing up in my project REPL classpath at all…
I sanity check and it’s on Maven: https://mvnrepository.com/artifact/com.github.afester.javafx/FranzXaver/0.1

Then I tried just putting in jibberish

{:deps
 {cljfx {:mvn/version "1.4.1"}}
 {wlijeqwliejqwcom.github.afester.javafx/FranzXaver {:mvn/version "0.1"}}
 {thi.ng/geom-viz {:mvn/version "0.0.908"}}}

crazy… but this didn’t throw any errors or warnings

If I run with the tree flag it just ignores the second line

$ clj -Stree
org.clojure/clojure 1.10.1
  org.clojure/core.specs.alpha 0.2.44
  org.clojure/spec.alpha 0.2.176
cljfx/cljfx 1.4.1
  org.openjfx/javafx-media 12
    org.openjfx/javafx-media$linux 12
  org.openjfx/javafx-controls 12
    org.openjfx/javafx-controls$linux 12
  org.openjfx/javafx-graphics 12
    org.openjfx/javafx-graphics$linux 12
  org.openjfx/javafx-base 12
    org.openjfx/javafx-base$linux 12
  org.openjfx/javafx-web 12
    org.openjfx/javafx-web$linux 12

Then I tried to switch to Github

{:deps
 {cljfx {:mvn/version "1.4.1"}}
 {afester/FranzXaver
  {:git/url "https://github.com/afester/FranzXaver"
   :sha "d3203092239ce492572b6608f526a5eaf77b0bf1"}}
 {thi.ng/geom-viz {:mvn/version "0.0.908"}}}

Also no luck…

I’m out of ideas :frowning:

You are just nesting things incorrectly. :deps is expecting a map with symbol keys.

{:deps
 {cljfx {:mvn/version "1.4.1"}
  com.github.afester.javafx/FranzXaver {:mvn/version "0.1"}
  thi.ng/geom-viz {:mvn/version "0.0.908"}}}

You are basically just adding an extra top level map entry where {wlijeqwliejqwcom.github.afester.javafx/FranzXaver {:mvn/version "0.1"}} is the key with {thi.ng/geom-viz {:mvn/version "0.0.908"}} as the value.

3 Likes

Oh how embarrassing. It’s funny how it half worked. Thanks for helping me out. I would have spent a long time scratching my head over this…

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.