Skip to content

Instantly share code, notes, and snippets.

@cemerick
Created June 5, 2017 15:11
Show Gist options
  • Save cemerick/00e9e8d1da6461d9daaddd0232943411 to your computer and use it in GitHub Desktop.
Save cemerick/00e9e8d1da6461d9daaddd0232943411 to your computer and use it in GitHub Desktop.
optional alternative :filespec destination path
; e.g. usage
:filespecs [{:type :path :path "source/directory" :root "destination/directory/"}]
; at the end of project.clj
(require 'leiningen.jar)
(in-ns 'leiningen.jar)
(defmethod copy-to-jar :path [project jar-os acc spec]
(let [root-file (io/file (:path spec))
root-dir-path (unix-path (dir-string root-file))
destination-root (:root spec)
paths (for [child (file-seq root-file)
:let [path (relativize-path
(full-path child (unix-path (str child)))
root-dir-path)]]
(when-not (or (skip-file? child path root-file
(:jar-exclusions project))
(added-file? child path acc))
(put-jar-entry! jar-os child (str destination-root path))
path))]
(into acc paths)))
(in-ns 'leiningen.core.project)
@cemerick
Copy link
Author

cemerick commented Jun 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment