technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.6k forks source link

java.library.path is overridden when there is a native dependency #2447

Open yerlikayahamza opened 6 years ago

yerlikayahamza commented 6 years ago

I am working in a project where I've native dependencies managed by lein (i.e rxtx) and native dependencies managed externally (Matlab). Documentation says that one should use jvm-opts to set the value of java.library.path. Following correctly sets the property,

(defproject asd "0.1.0-SNAPSHOT"
   :dependencies [[org.clojure/clojure "1.8.0"]]
   :jvm-opts ["-Djava.library.path=/Matlab/bin/glnxa64/"])

However if you add a native dependency,

 (defproject asd "0.1.0-SNAPSHOT"
    :dependencies [[org.clojure/clojure "1.8.0"]
                   [rxtx22 "1.0.6"]]
    :jvm-opts ["-Djava.library.path=/Matlab/bin/glnxa64/"])

Changes the path to target/native/linux/. Checking CLI options used by lein, both -Ds are there however the one added by lein overrides the user supplied one.

technomancy commented 2 years ago

You're right; it would be better to alter the existing setting rather than overriding it. Happy to take a patch for this.