Trouble with dependencies

19 views
Skip to first unread message

gsin...@gmail.com

unread,
Sep 29, 2021, 2:31:40 AMSep 29
to Cursive
Hi all,

I am a small-time but appreciative user of Cursive and am working on a Clojure project now for the first time in a long time. I set up IntelliJ and Cursive from scratch on a new machine, am having trouble with dependencies, and would love a pointer or two.

First problem

My project is a Leiningen one. When I add a dependency (e.g. ["hiccup", 1.0.5]), Cursive notices this and offers to download the new package. Great. But when I put [hiccup.core :as h] in the namespace in my code and reload the file in the REPL, I get an error, saying that hiccup__core isn't in the classpath, or something very close to that.

When I restart IntelliJ, all is good. I just can't seem to use a newly-chosen dependency without restarting, and I figure there must be a way.

Second problem

I currently have two clojure files in my project, let's call them main.clj and util.clj, where the first one requires the second in the namespace. When I start IntelliJ afresh, naturally I need to load these into my REPL. Logically, I should only have to load main.clj and it would pull in the contents of util.clj. But that's not what happens. I actually need to load util.clj myself and then load main.clj.

That's fine, I can do that, but a "real" Clojure project would not just have two files, so there must be something I've done wrong for this not to work automatically.

I'm pretty sure I've read all the info on the website, but I may have missed or misunderstood something. Also, my understanding of Leiningen and project structures in general is embarrassingly superficial.

Thanks a lot for any help,
Gavin

gsin...@gmail.com

unread,
Oct 19, 2021, 12:05:50 AMOct 19
to Cursive
OK, I sorted it out. Turned out I had a compile error in my secondary Clojure file that was blocking effective auto-loading. Yet when I loaded it manually I didn't get a repeat of that compile error. I don't know why, but it doesn't bother me as everything is working nicely now.
Reply all
Reply to author
Forward
0 new messages