-
-
Notifications
You must be signed in to change notification settings - Fork 180
Configuring Boot
It is useful to distinguish two sets of orthogonal concerns while talking about Boot configuration: configuring Boot itself vs configuring your Clojure project (that Boot is going to instrument).
tl;dr Boot itself is configured with environment variables, while your Clojure project is configured with build.boot.
Configuring Boot means controlling the JVM environment before your project is loaded. Configuring your Clojure project means declaring dependencies, specifying which tasks to run, etc. Environment variables and boot.properties
are used in the first case, profile.boot
and build.boot
in the latter.
Configuring the Java environment that bootstraps Clojure is done via environment variables. Boot being a self-documented toolchain, you can query the environment variables that Boot understands by invoking boot -h
on the command line.
-
`BOOT_AS_ROOT` Set to 'yes' to allow boot to run as root.
-
`BOOT_CLOJURE_VERSION` The version of Clojure boot will provide (1.6.0).
-
`BOOT_HOME` Directory where boot stores global state (~/.boot).
-
`BOOT_FILE` Build script name (build.boot).
-
`BOOT_JVM_OPTIONS` Specify JVM options (Unix/Linux/OSX only).
-
`BOOT_LOCAL_REPO` The local Maven repo path (~/.m2/repository).
-
`BOOT_VERSION` Specify the version of boot core to use.
-
`BOOT_COLOR` Turn colorized output on or off
A special case that belongs in our Boot configuration chapter is when you want to pin your project to a specific Boot version. This is covered in depth here, but in a nutshell:
$ boot -V > boot.properties
On the other hand, if you want to force a Boot version globally (downgrading, for example), you can do it with environment variables, like this:
BOOT_VERSION=xxx BOOT_CLOJURE_VERSION=yyy boot -u
Or via a global properties files, which can be written in $BOOT_HOME/cache/boot.properties
Editing boot.properties
by hand isn't recommended because it needs to have both BOOT_CLOJURE_VERSION
and BOOT_VERSION
and it needs to be a valid properties file. (Redirecting the output of boot -V
is recommended)
Precedence rules: Environment variables override boot.properties.
profile.boot
and build.boot
configure you Clojure project, they impact the program that runs once clojure is bootstrapped. profile.boot
is a global configuration file that lives in BOOT_HOME
, which defaults to ~/.boot
.
Precedence rules: profile.boot
and build.boot
are concatenated. Anything you do in profile.boot
will be evaluated before the expressions in build.boot, so the expressions in build.boot
can override, redef, etc anything done in profile.boot
.
This can be used to modify how boot works at the lowest levels, in every
pod. For example, we could change the default repositories that boot
uses to load itself during bootstrapping by creating a boot-shim.clj
file either in the BOOT_HOME
or the current working directory with the
following contents:
(try (require 'boot.aether)
(eval '(reset! boot.aether/default-repositories
[["public" {:url "http://repo.local/public/"}]
["private" {:url "http://repo.local/private/"}]]))
(catch Throwable _))
This file will be evaluated via clojure.core/load-file in each Clojure runtime that's created (all pods, including the main one in which the build.boot runs). Clojure core will be available but no boot-related code will have been loaded or run yet.
So you can use it to patch clojure core if you want or basically override anything in clojure or boot by doing alter-var-root, etc.
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util