Fork me on GitHub
#lsp
<
2023-11-04
>
lassemaatta07:11:28

I have a local Java/maven project, which produces e.g. foobar-1.0-SNAPSHOT.jar (= bunch of .class files) and foobar-1.0-SNAPSHOT-sources.jar (= the original .java sources). Can I somehow import this library in a Leiningen project such that the original java sources are available for clojure-lsp (= "If the java source(`.java`) is available on classpath, clojure-lsp just return that file location.")? EDIT: solved.

lassemaatta07:11:45

If I just include the library in project.clj, then clojure-lsp will decompile the .class files instead of displaying the originals.

lassemaatta07:11:11

ah, adding e.g. [com.acme/foobar "1.0-SNAPSHOT" :classifier "sources"] to project.clj adds the -sources.jar to the classpath 💡

ericdallo12:11:48

I didn't know about that! Good to know, it's something I wondered before as well :)

ericdallo12:11:06

I wonder how that works for deps.edn

lassemaatta12:11:48

I don't have a deps.edn project at hand, but looking at the https://clojure.org/reference/deps_and_cli#_dependencies I guess something like com.acme/foobar$sources might do the trick

😯 1