Reputation: 8376
I use emacs (to be more precise, Spacemacs), and so far, I haven't seen any way to add a project dependency (say, ring or hiccup) to my project, other than opening ./project.clj and adding a new vector to :dependencies
. I'm not feeling comfortable doing this because I need to remember exact version of the package I want to add as a dependency, and multiplied by possible number of these packages, this amount of information is clearly not for a human head. Meanwhile, I have a strong feeling that it's possible to add a project dependency either via CLI or in emacs directly (perhaps Cider?). Is it possible, and how do I do this?
Upvotes: 3
Views: 1428
Reputation: 12883
Managing this by hand is not difficult. As you said you simply open your project.clj file in your editor and add dependencies.
You can find the current version by either checking the project's page or by searching for it on clojars' or maven's website. If you know what you need it only takes a few minutes, and if you're not writing throw away code a few minutes is nothing compared to the life of the project.
To maintain dependencies, something like lein ancient is very helpful.
Upvotes: 1
Reputation: 10474
In Spacemacs you can use clj-refactor
to help you with this. Navigate to your project.clj
, cider jack-in
with ,'
and press ,rap
(major mode, refactor, add, project dependency) for cljr-add-project-dependency
.
In the menu you can search for an artifact available in Clojars:
and select one of the available versions:
When you press enter the dependency is added to the bottom of the list.
Upvotes: 5