Common build utilities.
The following high-level defaults are provided:
:target "target", :basis (create-basis {:project "deps.edn"}, :class-dir (str target "/classes"), :jar-file (format "%s/%s-%s.jar" target lib version), :uber-file (format "%s/%s-%s.jar" target lib version) or, if :version is not provided: (format "%s/%s-standalone.jar" target lib)
You are expected to provide :lib and :version as needed.
The following build task functions are provided, with the specified required and optional hash map options:
clean -- opt :target, deploy -- req :lib, :version opt :target, :class-dir, :jar-file (see docstring for additional options) install -- req :lib, :version opt :target, :class-dir, :basis, :jar-file (see docstring for additional options) jar -- req :lib, :version opt :target, :class-dir, :basis, :scm, :src-dirs, :resource-dirs, :tag, :jar-file (see docstring for additional options) uber -- req :lib or :uber-file opt :target, :class-dir, :basis, :scm, :src-dirs, :resource-dirs, :tag, :version (see docstring for additional options) run-task -- [opts aliases] opt :java-opts -- defaults to :jvm-opts from aliases :jvm-opts -- added to :java-opts :main -- defaults to clojure.main :main-args -- defaults to :main-opts from aliases :main-opts -- added to :main-args run-tests -- opt :aliases (plus run-task options) invokes (run-task opts (into [:test] aliases))
All of the above return the opts hash map they were passed (unlike some of the functions in clojure.tools.build.api).
The following low-level defaults are also provided to make it easier to call the task functions here:
:ns-compile if :main is provided and :sort is not, this defaults to the :main namespace (class),
:scm if :tag is provided, that is used here, else if :version is provided, that is used for :tag here with "v" prefixed,
:src-dirs ["src"]
:src+dirs this is a synthetic option that is used for the
file/directory copying that is part of jar
and
uber
and it is computed as :src-dirs plus
:resource-dirs, essentially, with the former
defaulted as noted above and the latter defaulted
to ["resources"] just for the copying but otherwise
has no default (for tools.build/write-pom
).
Common build utilities. The following high-level defaults are provided: :target "target", :basis (create-basis {:project "deps.edn"}, :class-dir (str target "/classes"), :jar-file (format "%s/%s-%s.jar" target lib version), :uber-file (format "%s/%s-%s.jar" target lib version) or, if :version is not provided: (format "%s/%s-standalone.jar" target lib) You are expected to provide :lib and :version as needed. The following build task functions are provided, with the specified required and optional hash map options: clean -- opt :target, deploy -- req :lib, :version opt :target, :class-dir, :jar-file (see docstring for additional options) install -- req :lib, :version opt :target, :class-dir, :basis, :jar-file (see docstring for additional options) jar -- req :lib, :version opt :target, :class-dir, :basis, :scm, :src-dirs, :resource-dirs, :tag, :jar-file (see docstring for additional options) uber -- req :lib or :uber-file opt :target, :class-dir, :basis, :scm, :src-dirs, :resource-dirs, :tag, :version (see docstring for additional options) run-task -- [opts aliases] opt :java-opts -- defaults to :jvm-opts from aliases :jvm-opts -- added to :java-opts :main -- defaults to clojure.main :main-args -- defaults to :main-opts from aliases :main-opts -- added to :main-args run-tests -- opt :aliases (plus run-task options) invokes (run-task opts (into [:test] aliases)) All of the above return the opts hash map they were passed (unlike some of the functions in clojure.tools.build.api). The following low-level defaults are also provided to make it easier to call the task functions here: :ns-compile if :main is provided and :sort is not, this defaults to the :main namespace (class), :scm if :tag is provided, that is used here, else if :version is provided, that is used for :tag here with "v" prefixed, :src-dirs ["src"] :src+dirs this is a synthetic option that is used for the file/directory copying that is part of `jar` and `uber` and it is computed as :src-dirs plus :resource-dirs, essentially, with the former defaulted as noted above and the latter defaulted to ["resources"] just for the copying but otherwise has no default (for `tools.build/write-pom`).
(clean {:keys [target] :as opts})
Remove the target folder.
Remove the target folder.
(default-basis)
Return the default basis.
Return the default basis.
(default-class-dir)
(default-class-dir target)
Return the default class-dir
.
May be passed a non-default target directory name.
Return the default `class-dir`. May be passed a non-default target directory name.
(default-jar-file version)
(default-jar-file lib version)
(default-jar-file target lib version)
Given the lib
and version
, return the default JAR
filename.
lib
can be omitted and will default to 'application
(for uberjar usage).
May be passed a non-default target directory name.
Given the `lib` and `version`, return the default JAR filename. `lib` can be omitted and will default to `'application` (for uberjar usage). May be passed a non-default target directory name.
(default-target)
Return the default target directory name.
Return the default target directory name.
(deploy {:keys [lib version artifact class-dir installer jar-file pom-file
target]})
Deploy the JAR to Clojars.
Requires: :lib, :version
Accepts any options that are accepted by:
deps-deploy/deploy
If :artifact is provided, it will be used for the deploy,
else :jar-file will be used (making it easy to thread
options through jar
and deploy
, specifying just :jar-file
or relying on the default value computed for :jar-file).
Deploy the JAR to Clojars. Requires: :lib, :version Accepts any options that are accepted by: * `deps-deploy/deploy` If :artifact is provided, it will be used for the deploy, else :jar-file will be used (making it easy to thread options through `jar` and `deploy`, specifying just :jar-file or relying on the default value computed for :jar-file).
(install {:keys [lib version basis class-dir classifier jar-file target]})
Install the JAR to the local Maven repo cache.
Requires: :lib, :version
Accepts any options that are accepted by:
tools.build/install
Install the JAR to the local Maven repo cache. Requires: :lib, :version Accepts any options that are accepted by: * `tools.build/install`
(jar {:keys [lib version basis class-dir jar-file main manifest repos
resource-dirs scm src-dirs src-pom tag target transitive]})
Build the library JAR file.
Requires: :lib, :version
Accepts any options that are accepted by:
Writes pom.xml into META-INF in the :class-dir, then copies :src-dirs + :resource-dirs into :class-dir, then builds :jar-file into :target (directory).
If you are building a JAR in a monorepo and rely on :local/root dependencies for the actual source components, such as in a Polylith project, pass :transitive true to use a 'lifted' basis and to ensure all source files are copied into the JAR.
Build the library JAR file. Requires: :lib, :version Accepts any options that are accepted by: * tools.build/write-pom * tools.build/jar Writes pom.xml into META-INF in the :class-dir, then copies :src-dirs + :resource-dirs into :class-dir, then builds :jar-file into :target (directory). If you are building a JAR in a monorepo and rely on :local/root dependencies for the actual source components, such as in a Polylith project, pass :transitive true to use a 'lifted' basis and to ensure all source files are copied into the JAR.
(run-task {:keys [java-opts jvm-opts main main-args main-opts] :as opts}
aliases)
Run a task based on aliases.
If :main-args is not provided and no :main-opts are found in the aliases, default to the Cognitect Labs' test-runner.
Run a task based on aliases. If :main-args is not provided and no :main-opts are found in the aliases, default to the Cognitect Labs' test-runner.
(run-tests {:keys [aliases] :as opts})
Run tests.
Always adds :test to the aliases.
Run tests. Always adds :test to the aliases.
(uber {:keys [lib uber-file] :as opts})
Build the application uber JAR file.
Requires: :lib or :uber-file
Accepts any options that are accepted by:
tools.build/write-pom
tools.build/compile-clj
tools.build/uber
The uber JAR filename is derived from :lib and :version if provided, else from :uber-file.
If :version is provided, writes pom.xml into META-INF in the :class-dir, then
Compiles :src-dirs into :class-dir, then copies :src-dirs and :resource-dirs into :class-dir, then builds :uber-file into :target (directory).
Build the application uber JAR file. Requires: :lib or :uber-file Accepts any options that are accepted by: * `tools.build/write-pom` * `tools.build/compile-clj` * `tools.build/uber` The uber JAR filename is derived from :lib and :version if provided, else from :uber-file. If :version is provided, writes pom.xml into META-INF in the :class-dir, then Compiles :src-dirs into :class-dir, then copies :src-dirs and :resource-dirs into :class-dir, then builds :uber-file into :target (directory).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close