cider 2025-05-07

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)?

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

Apologies for the delay.

Yes I can jump to java.lang.String

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

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

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

Add "javasrc" to :source-paths

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?

You have to put it into both

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

Thank you very much

🙏 1

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?

This is how Leiningen does it, that's all

A good enough reason. Thanks again

👍 1