cider

2025-05-07T18:45:08.895729Z

I've got a leiningen project with mostly Clojure and a little bit of Java - should I be able to jump to the Java definitions with M-. when jacked in to Cider (1.18)?

oyakushev 2025-05-07T19:35:49.805809Z

You should! First of all, can you jump to JDK class like java.lang.String or to Clojure runtime class, like clojure.lang.RT?

2025-05-10T14:22:00.642039Z

Apologies for the delay.

2025-05-10T14:22:25.374139Z

Yes I can jump to java.lang.String

oyakushev 2025-05-10T14:23:03.204449Z

So it's 3rd-party library that the jump doesn't work to yet? Have you enabled cider-download-java-sources variable? Through M-x customize-variable

2025-05-10T14:23:29.339639Z

I made this repo https://github.com/pedro-w/testjump - the java code is part of the project, not a 3rd party.

oyakushev 2025-05-10T14:24:01.660949Z

I see. In that case, you have to put the directory with java sources onto the classpath

oyakushev 2025-05-10T14:24:25.406229Z

Add "javasrc" to :source-paths

2025-05-10T14:25:32.962259Z

Oho, I put it in :java-source-paths (don't know where that came from, it's quite an old project). I can lein run it OK though, so does that mean my class is on the classpath already?

oyakushev 2025-05-10T14:25:50.426739Z

You have to put it into both

2025-05-10T14:26:07.167999Z

doing that now ...

oyakushev 2025-05-10T14:26:08.575279Z

Leiningen looks at :java-source-paths for Java sources to compile them before the REPL starts. But those files/directories aren't put onto the runtime classpath. For that, :source-paths

👍 1
2025-05-10T14:27:51.946539Z

WORKS!

2025-05-10T14:27:58.058669Z

Thank you very much

🙏 1
2025-05-10T14:30:30.855329Z

Is there a legitimate reason to have a path in :java-source-paths and not in :source-paths ? In other words could j-s-p be added to the classpath automatically?

oyakushev 2025-05-10T14:31:09.685579Z

This is how Leiningen does it, that's all

2025-05-10T14:31:29.691299Z

A good enough reason. Thanks again

👍 1