Liking cljdoc? Tell your friends :D

Clojars Project Slack community


A tool for generating stubs for open and closed source libraries




To generate stubs you need to pass the classpath and at least one namespace from namespaces to stub later require it and generate the stubs for those namespaces. You can specify a optional output-dir, otherwise the stubs folder will be used. For more details check stub --help.

After running successfully, a hierarchy of files and folders with all the stubs should be available with custom metadata. Example:


(in-ns '
(defn ^{:clj-easy/stub true, :line 16, :column 1, :file "foo/bar.clj"} something ([]) ([a b]))
(defn ^{:clj-easy/stub true, :line 18, :column 1, :file "foo/bar.clj"} other ([]))


stub --classpath ".../clojure.jar:/foo/bar.jar" --namespaces --namespaces foo.baz

stub -c ".../clojure.jar:/foo/bar.jar" -n -o /tmp/stubs


For now the only entrypoint available is clj-easy.stub.core/generate!.

How does it work

This tool first create a temporary file with a custom clojure code, then shell out a java process with the specified classpath calling the code from the created temporary file which should get all necessary metadata and then finish, then stub should create all files from that metadata.


Run clj -M:run generate --classpath "<your-classpath>" --namespaces some.entrypoint-ns


JVM cli

clj -T:build uber

JVM api

clj -T:build jar

GraalVM native image

clj -T:build native


To tag and deploy to clojars + generate the native image on releases:

clj -T:build tag :version '"1.3.4"'


Copyright © 2021 clj-easy maintainers

Distributed under the Eclipse Public License version 1.0.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close