Package up Clojure projects in various ways, based on a deps.edn file.
Pack can add itself to your deps.edn automatically. It will not modify your indentation style at all. This is alpha, but so is everything else in this project.
It can be run at later times, in order to automatically bump the sha in your deps.edn.
It will continue to work even if you rename the default :pack
alias to something else.
Note
|
This isn’t infallible. Please let me know if I break your indentation. |
clj -Sdeps '{:deps {pack/pack.alpha {:git/url "https://github.com/juxt/pack.alpha.git" :sha "dccf2134bcf03726a9465d2b9997c42e5cd91bff"}}}' -m mach.pack.alpha.inject 7f46098598f70da960264d6e33e3aed7a107e1bc
The following examples assume you have run this.
The lambda approach will generate a zip which can be uploaded to AWS.
clj -A:pack mach.pack.alpha.aws-lambda deps.edn lambda.zip build_dir
In this example:
-
deps.edn
is the location of the deps.edn to consume. -
lambda.zip is where to write the package to.
-
build_dir is a directory containing extra paths to add, for example it may be where you compile classes to, or write built css to.
$ clj -A:pack mach.pack.alpha.capsule -O uberjar.jar -e build-dir --application-id mycoolapp --application-version "$(git describe)" -m myapp.main
$ java -jar uberjar.jar
Usage: clj -m mach.pack.alpha.capsule [options] <path/to/output.jar>
Options:
-m, --main SYMBOL main namespace
--application-id STRING globally unique name for application, used for caching
--application-version STRING unique version for this uberjar, used for caching
-e, --extra-path STRING add directory to classpath for building
-d, --deps STRING deps.edn deps.edn file location
-h, --help show this help
The main does not need :gen-class
, it follows the same semantics as clojure.main’s -m main
.
If main is not specified, it will default to clojure.main
, meaning it can take options like -m
or -r
.
extra-path
is useful for adding clojurescript & css to the resulting jar.
It can be used multiple times.
INFO: In the future I will extend Capsule support to include capsule-specific features, such as caplets and many of the related manifest attributes.
OneJAR builder.
This is a suitable replacement for jdsoft JCL, without the GPL license.
It’s especially practical where you can’t extract into a ~/.capsule
directory, or don’t need to bake in JVM args.
Usage: clj -m mach.pack.alpha.one-jar [options] <path/to/output.jar>
Options:
-e, --extra-path STRING add directory to classpath for building
-d, --deps STRING deps.edn deps.edn file location
-h, --help show this help
output.jar is where to put the output uberjar. Leading directories will be created.
Example:
$ clj -A:pack mach.pack.alpha.one-jar output.jar
$ java -jar output.jar