If you don’t have a project, you add your dependencies in your global lein user profile instead located at ~/.lein/profiles.clj
.
The doc isn’t great for lein to be honest. So this part is confusing. But you edit that file as such:
{:user {:plugins [[lein-pprint "1.1.1"]]
:dependencies [[slamhound "1.3.1"]]}}
In the :plugins
vector you add whatever global lein plugin you want to have. And in the :dependencies
vector you add whatever library you want available globally.
Then anywhere you start a lein repl
you’d have those dependencies available to you. And everywhere you run lein
you’ll have the additional plugin features available to you.
If you use tools.deps instead of lein, aka, the clj
command instead of the lein
command. Then it is a bit different. You instead want to modify your ~/.clojure/deps.edn
file. Where you’d add dependencies there instead:
{:deps {clj-time {:mvn/version "0.14.2"}}}
So if you put the above in your user deps.edn whenever you run clj
command the clj-time library will be available to you.