Fork me on GitHub
#tools-deps
<
2020-03-21
>
practicalli-john23:03:27

How would I include the Java sources in the :path of my deps.edn configuration? The sources are currently in a src.zip file, from the install. Is it as simple as using "src.zip" to the :path configuration? Or would I need to extract and a the specific directories relative to the Clojure project? Also wondering how to include these sources to multiple projects, either using an alias in ~/.clojure/deps.edn or creating a symbolic link to the src.zip file (or extracted directory).

andy.fingerhut23:03:16

Neither the clj nor clojure commands will do anything with Java sources, unless you somehow use them to run a program that looks for and does something with Java source files.

andy.fingerhut23:03:46

e.g. if you are using something like mevyn program to compile Java source files: https://github.com/clojure/tools.deps.alpha/wiki/Tools

potetm01:03:06

OR you can compile the src w/ javac into target/classes and add "target/classes" to your :paths

dominicm07:03:27

I think the src.zip is referring to the ones that come with the jdk. They're used by cider to allow you to jump to source on java code.

dominicm07:03:27

@U05254DQM I think zip files are fine on the classpath. A :local/root should be fine.

👍 4
practicalli-john08:03:29

@U09LZR36F that sounds what I am looking for, thank you.

practicalli-john11:03:56

It works. I have a deps.edn as follows

{:path 
 ["src" "resources"]

 :deps
 {org.clojure/clojure {:mvn/version "1.10.1"}

  ;; Java 11 sources
  java-sources {:local/root "/usr/lib/jvm/openjdk-11/lib/src.zip"}}}
I can now browse java sources in Spacemacs with clj-find-var . Thanks everyone.

dominicm13:03:31

Remember that the location will vary for everyone :)