-
-
Notifications
You must be signed in to change notification settings - Fork 180
Boot Environment
The boot environment contains the current JVM classpath configuration state.
- (get-env)
- Returns the whole environment map.
- (get-env key)
-
Returns the value associated with the given
key
, ornil
if thekey
is not found. - (get-env key not-found)
-
Returns the value associated with the given
key
, ornot-found
if thekey
is not found. -
(set-env! key val & kvs)
-
Sets the values for the given
key
s. Note that this may produce side effects, changes to the JVM's classpath, etc.
Note: Env settings must be printable and writable–the env must be able to be passed to Pods to configure them, so the env map must always be able to be round-tripped through
pr-str
andread-string
.
Calling set-env!
with regular key value pairs replaces the values with the
newly specified ones:
(set-env! :source-paths #{"foo" "bar"})
It's important to understand that this does not always modify the JVM environment
accordingly. For example, it's possible to use set-env!
to remove dependencies
from the boot env, but dependency JARs cannot be removed from classloaders in the
JVM once they've been added.
Since env values must be able to be printed and read by the Clojure reader only
"simple" values can ever be in the env. The set-env!
function exploits this
so when the env value is a function it applies the function to the current env
value and sets the new value to the result:
(set-env! :source-paths #(conj % "baz"))
The function must, of course, return a valid env value.
- :resource-paths
- A set of path strings. These paths will supply the content that will be on the classpath of the initial Fileset, and the files contained will be marked with roles +INPUT,+OUTPUT and so be emitted as final artifacts.
- :source-paths
- A set of path strings. These paths will supply the content that will be on the classpath of the initial Fileset, and the files contained will be marked with roles +INPUT,-OUTPUT, so they may be used to generate output but will not themselves be emitted as final artifacts.
- :asset-paths
- A set of path strings. These paths will not be on the classpath but the files contained will be emitted as final artifacts.
- :directories
-
A set of path strings — the directories on the class path. These are the actual temporary directories that boot copies files from source and resource paths into before building the project.
This key is used internally by boot. You probably don't want to alter this, but you may need to read from it, for example when creating pods that need special class path setup.
- :target-path (deprecated)
- A path string. This directory is where final artifacts will be written. Default value is
"target"
. Note that as of Boot 2.5, setting a target directory using :target-path has been deprecated in favor of the builtin target task. For more information, see Target Directory. - :dependencies
-
A vector of Maven coordinates (see pomegranate).
Note: Boot will not automatically deal with non-jar files; you must explicitly indicate the type. For example, for a zipfile dependency, add
:extension "zip"
to the coordinate vector. - :exclusions
-
A vector of Maven ids to ignore globally when resolving transitive dependencies. Equivalent to adding an
:exclusions
key to every dependency.Note: Setting
:exclusions
will exclude the dependencies plus any of their own transitive dependencies, unless another dependency pulls it in. For example if I have[[foo/bar "1.2.3" :exclusions [foop/barp]] [baz/baf "2.3.4"]]
in my dependencies, andbaz/baf
has a transitive dependency onfoop/barp
you will get the version offoop/barp
from there. - :repositories
- A vector of Maven repositories (see pomegranate).
- :wagons
-
A vector of Maven wagon dependencies (see
:dependencies
). These dependencies should containwagons.clj
files. - :local-repo
-
The path to the location of the local Maven repository (see pomegranate).
This key is used internally by boot. To set the local repository location you probably want to use the
BOOT_LOCAL_REPO
environment variable instead. - :offline?
-
When set to
true
dependencies will not be resolved or fetched from remote repositories (see pomegranate).This has no effect on boot's initial bootstrapping phase.
- :mirrors
- A map of Maven mirrors (see pomegranate).
- :proxy
- A map of Maven proxy configuration (see pomegranate).
- :transfer-listener
- A Maven transfer listener configuration (see pomegranate).
- :watcher-debounce
- Set the debouncing interval (milliseconds) for syncing files from project directories into the boot-managed temporary directories in the fileset. The default is 10. Increasing this may help when there are many files and other processes are editing them in parallel.
- :checkouts
-
Add dependencies to be considered "checkout dependencies". Format is the same as for
:dependencies
(eg.[foo/bar 1.2.3]
inbuild.boot
). When a dependency is added using the checkout option it's jar in your local Maven repository will be checked for changes and if the jar is updated it will replace the old jar on the Classpath. Most of the time:checkouts
are used in conjunction with runningboot watch build-jar
(or equivalent) in the checked out project to install new jars as the code is changed.
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