   [lein-project]
   (let [deps (filter include-dep? (:dependencies lein-project))]
     (vec (mapcat (partial cp-shared-config-files-for-dep lein-project) deps))))
+
+;; TODO: these cp-doc-files and cp-shared-config-files functions have a lot of
+;; overlap, should probably refactor.
+(defn find-doc-files
+  [jar-file]
+  {:pre [(instance? JarFile jar-file)]
+   :post [(every? #(instance? JarEntry %) %)]}
+  (filter
+    #(and (.startsWith (.getName %) docs-prefix)
+          (not= docs-prefix (.getName %)))
+    (enumeration-seq (.entries jar-file))))
+
+(defn cp-doc-file
+  [proj-name jar-file doc-file]
+  (println "Copying doc file:" (.getName doc-file))
+  (let [orig-file (File. (.getName doc-file))
+        ;; This is a bit complex; we want to put the doc files into the staging
+        ;; dir under `ext/docs/<project-name>/<original-dir-structure-in-project`.
+        ;; To build this path we need to find <original-dir-structure-in-project>
+        ;; and then remove the first two elements (which will be "ext/docs").
+        rel-dir  (->> orig-file
+                     .getParentFile
+                     .toPath
+                     .iterator
+                     iterator-seq
+                     (drop 2)
+                     (mapv #(.toString %))
+                     (str/join "/")
+                     (File.))
+        out-dir  (fs/file staging-dir "ext" "docs" proj-name rel-dir)
+        out-file (fs/file out-dir (.getName orig-file))]
+    (fs/mkdirs out-dir)
+    (spit out-file
+          (slurp (.getInputStream jar-file doc-file)))
+    out-file))
+
+(defn cp-doc-files-for-dep
+  [lein-project dep]
+  (println "Checking for doc files in dependency:" dep)
+  (let [jar-file (find-maven-jar-file dep lein-project)
+        doc-files (find-doc-files jar-file)
+        proj-name (name (first dep))]
+    {(keyword proj-name) (mapv (partial cp-doc-file proj-name jar-file) doc-files)}))
+
+(defn cp-doc-files
+  [lein-project]
+  (let [deps (filter include-dep? (:dependencies lein-project))]
+    (apply merge (mapv (partial cp-doc-files-for-dep lein-project) deps))))
 
 (defn -main
   [& args]

  (let [artifact-id (first dep)]
    (not (contains? exclude-dependencies artifact-id))))

(defn cp-shared-config-file
  [jar-file conf-file]
  (println "Copying shared config file:" (.getName conf-file))


(defn cp-template-files
  [template-dir]
  (println "copying template files from" (.toString template-dir) "to" staging-dir)
  (fs/copy-dir template-dir staging-dir))

(defn cp-project-file
