practicalli / spacemacs

Content for the book - Clojure Development with Spacemacs
https://practical.li/spacemacs
Creative Commons Attribution Share Alike 4.0 International
110 stars 33 forks source link

Setting Clojure CLI tools as the default #219

Closed practicalli-johnny closed 3 years ago

practicalli-johnny commented 4 years ago

If you have more than one project configuration file (project.clj, deps.edn, build.boot) then cider-jack-in commands should display a prompt allowing you to choose which configuration to use. To specify the default project configuration for CIDER, create a dir-locals.el file in the root of your project directory containing the following

((clojure-mode . ((cider-preferred-build-tool . "clojure-cli"))))

I have not tested this with clj-refactor as I stopped using that library a long while ago. If it doesnt work wth clj-refactor, then consider raising an issue or better yet a PR. (edited)

If using Clojure CLI tools you can also set default aliases too, for example

((clojure-mode . ((cider-clojure-cli-global-options . "-A:fig"))))

https://practicalli.github.io/blog/posts/cider-jack-in-to-clojure-cli-projects-from-spacemacs/ (edited)

And if you have multiple clojure projects under one git repository, you can tell projectile to treat them all as Clojure projects using

((nil . ((projectile-project-type . clojure-cli))))

https://practicalli.github.io/spacemacs/clojure-projects/monorepo-nested-projects.html