This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-13
Channels
- # announcements (14)
- # babashka (13)
- # beginners (25)
- # biff (7)
- # calva (36)
- # clj-kondo (22)
- # clojure (31)
- # clojure-austin (1)
- # clojure-europe (12)
- # clojure-losangeles (4)
- # clojure-nl (1)
- # clojure-norway (61)
- # clojure-uk (4)
- # clojurescript (3)
- # datomic (24)
- # events (1)
- # humbleui (9)
- # leiningen (9)
- # lsp (30)
- # malli (3)
- # missionary (15)
- # off-topic (5)
- # re-frame (4)
- # reitit (7)
- # releases (2)
- # remote-jobs (4)
- # rewrite-clj (11)
- # ring-swagger (2)
- # sci (6)
- # xtdb (2)
- # yamlscript (3)
This is probably a FAQ, but Google search did not find me the answer I need.
I have a leiningen project which depends upon few libraries, which are fetched from Maven Central and Clojars.
However, I want to patch one of the libraries and depend upon the patched version of the library.
I successfully rebuilt the library after patching it and I have its jar file locally.
I want my project.clj
to declare dependency upon the local jar file rather than upon the Maven Central/Clojars version.
How to specify this in the :dependencies
clause in project.clj?
Thanks!
Simplest thing would be to release your jar in Clojars, depend on it, and apply :exclusions
so that the original jar won't be depended on
Use lein deps :tree
to confirm that the original is zapped
Hope it helps!
For me it is not the simplest thing to do. Requires me to expose half-baked buggy code to the world. The most obvious thing to do is to have a way to depend upon a local jar, and this is what I am looking for.
I found https://clojure.org/reference/deps_edn
It specifies the following format for deps.edn
:
;; Local jar
localjar/name {:local/root "path/to.jar"
:exclusions [lib1 lib2]}}
I tried to translate it into Leiningen format as follows:
[target/name {:local/root "/path/to/target/name-0.11.1-beta-standalone.jar"}]
and got the following error message from lein deps
:
java.lang.IllegalArgumentException: Bad artifact coordinates target:name:jar:{:local/root "/path/to/target/name-0.11.1-beta-standalone.jar"}, expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
(there may be inaccuracies, because I censored the real names)
It is not clear to me how to write the expected format in my case.If you locally install your modified project, you can depend on it as a normal maven dep
Lein doesn’t support local jars like deps
How to do that depends on the other projects build - mvn install or lein install should do this for you