The slim way to build Clojure.
slim is a build tool for Clojure projects that emphasizes simplicity and minimal configuration. It helps you build uberjars for applications or build and deploy jars for libraries with zero ceremony.
deps.edn - no additional configuration files neededtools.build and slipset/deps-deployAdd slim to your deps.edn:
{:aliases
{:slim {:deps {io.github.abogoyavlensky/slim {:mvn/version "LATEST"}}
:ns-default slim.app
:exec-args {:main-ns my-app.core}}}}
Run the build:
clojure -T:slim build
That's it! Your uberjar will be created at target/standalone.jar.
Builds an uberjar file for an application. The minimal configuration requires only the main namespace:
{:deps {io.github.abogoyavlensky/slim {:mvn/version "LATEST"}}
:ns-default slim.app
:exec-args {:main-ns my-app.core}}
You can customize the build with optional parameters. All available options are shown below:
{...
:exec-args {:main-ns my-app.core
:target-dir "custom-target"
:uber-file "my-app.jar"
:src-dirs ["src" "resources" "custom-src"]
:class-dir "custom-classes"}}
:main-ns (required) - Main namespace to compile.:target-dir (optional) - Target directory for build artifacts (default: "target").:uber-file (optional) - Name of the output uberjar (default: "target/standalone.jar").:src-dirs (optional) - Source directories to include (default: ["src" "resources"]).:class-dir (optional) - class directory (default: "target/classes").| Command | Description |
|---|---|
build | Builds an uberjar file with all dependencies included. The uberjar file will be created at the specified location (defaults to target/standalone.jar). |
Builds and deploys a jar file for a library.
The minimal configuration requires the library name and version. It also requires the slipset/deps-deploy dependency to deploy the library to Clojars:
{:deps {io.github.abogoyavlensky/slim {:mvn/version "LATEST"}
slipset/deps-deploy {:mvn/version "0.2.2"}}
:ns-default slim.lib
:exec-args {:lib my-org/my-lib
:version "0.1.0"}}
Install locally:
clojure -T:slim install
Run the build and deploy snapshot version:
clojure -T:slim deploy :snapshot true
or deploy release version:
clojure -T:slim deploy
That's it! Your library has been built and deployed to Clojars.
Note: You need to have CLOJARS_USERNAME and CLOJARS_PASSWORD environment variables set to your Clojars credentials.
You can customize the build with optional parameters for extended metadata information in the library's pom-file.
{...
:exec-args {:lib my-org/my-lib
:version "0.1.0"
:url "https://github.com/my-org/my-lib"
:description "My awesome library"
:developer "Your Name"}}
:lib (required) - Library name in org/lib format.:version (required) - Library version. The version will be used as a git tag as-is. If you want to customize it, please use the :scm option.:url (optional) - Project URL. It will also be used as the SCM URL if option :scm-url is not set.:scm-url (optional) - Repository URL. If not set, defaults to :url.:description (optional) - Project description.:developer (optional) - Developer name.:license (optional) - If not set, defaults to: {:name "MIT License" :url "https://opensource.org/license/mit"}.The options :url, :description, :developer, and :license are used to generate the pom-file for the library.
If you need to customize the pom-file, you can pass the :pom-data option, which will take precedence over other options.
An example of :pom-data:
[[:description "My awesome library"]
[:url "https://github.com/username/lib"]
[:licenses
[:license
[:name "MIT License"]
[:url "https://opensource.org/license/mit/"]]]
[:developers
[:developer
[:name "Person Name"]]]]
By default, :scm is generated using :url, :scm-url and :version (as tag). If you need to customize your SCM repository data, you can pass the :scm option with a value:
{:url "https://github.com/username/lib"
:connection "scm:git:git://github.com/username/lib.git"
:developerConnection "scm:git:ssh://git@github.com/username/lib.git"
:tag "v0.1.0"}
Note: For other options, please consult the spec of the library and the definition of clojure.tools.build.api/write-pom function.
| Command | Description | Options |
|---|---|---|
build | Builds a jar file for the library. | :snapshot (optional) - If true, the jar will be built as a snapshot version. Default is false. |
install | Builds and installs the jar to local Maven repository. | :snapshot (optional) - If true, the jar will be installed as a snapshot version. Default is false. |
deploy | Builds and deploys the jar to Clojars (requires CLOJARS_USERNAME and CLOJARS_PASSWORD environment variables). | :snapshot (optional) - If true, the jar will be deployed as a snapshot version. Default is false. |
tag | Creates a git tag for the library version. | :push - If true automatically pushes the newly created git tag to remote repository. Default is false. |
MIT License Copyright (c) 2025 Andrey Bogoyavlenskiy
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |