Find unused dependencies in deps.edn or project.clj.
With babashka you have the following options:
Add this to your bb.edn:
:deps {io.github.borkdude/unused-deps {:git/sha "<latest-sha>"}}
:tasks {unused-deps {:task (prn (exec 'borkdude.unused-deps/unused-deps))
:exec-args {...} ;; other options here
}}Then run bb unused-deps. For more information about babashka tasks, look
here.
To install this tool with bbin:
$ bbin install io.github.borkdude/unused-deps
Then run in your project:
$ unused-deps
{:unused-deps [[clj-kondo/clj-kondo {:mvn/version "2025.04.07"}]]}
You can use the borkdude.unused-deps/exec-fn as an :exec-fn in deps.edn.
Require the namespace borkdude.unused-deps and use the unused-deps function.
Here are some options with examples which are hopefully self-explanatory. If not, bug me on slack or make a Github issue.
--root-dir .
--deps-file deps.edn / project.clj (relative to root-dir)
--classpath (optional, normally derived from deps-file)
--source-paths src (default)
The source paths are checked for namespaces that are required. If there is a
.jar file that doesn't contain any of these namespaces it's considered unused.
:local/rootisn't supported yet (should be easy to add)
- Some libraries, such as JDBC drivers, register themselves on the classpath and don't have any statically detectable code. These libraries might still be used but are reported as unused.
MIT, see LICENSE.