简体   繁体   中英

Unable to add dependencies or libraries in an existing leiningen project

I am using cider and leiningen for Clojure projects. But I am unable to add dependencies, or any library for the matter in a project after creation. But when I create a new project and add the same libraries, I don't see any errors then. Is this a bug or am I doing something wrong?

Walkthrough the problem:

1. lein new projectname
2. adding required libraries in project.clj and then lein deps
3. now write code in src/projectname/core.clj using the added libraries; works fine.

4. I forgot to add one more library; so back to step 2; done. Then step 3; failed!

5. Now make new project lein new projectname2
6. adding all the libraries which I required in projectname in project.clj
7. now write code in src/projectname2/core.clj using the added libraries; works fine.

In emacs cider for changes to the project.clj to take effect, you need to restart the session.

The most straightforward is to quit and reconnect:

M-x cider-quit
M-x cider-jack-in-clj

Or the equivalent short cuts, which for me would be Cc Cq Cc Mj

You can also do a restart, but note that it has to be a "hard" restart (good info on that here: https://metaredux.com/posts/2019/11/07/hard-cider-hard-restart.html )

M-x sesman-restart

Or (for me, at least) Cc Cs r

Hence:

  1. lein new projectname
  2. adding required libraries in project.clj and then lein deps

    2a. If you're currently in a cider session, restart it

  3. Write code in src/projectname/core.clj using the added libraries; works fine.

  4. Forgot to add one more library; so back to step 2; done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM