Fork me on GitHub
Yehonathan Sharvit06:06:37

Hi there! I’d like to deploy a library to clojars but only the files under the src folder. How can I do that?


@viebel do you want to deploy them within a jar?

Yehonathan Sharvit14:06:35

@mikerod Basically, I want the library to be consumable from other projects


As a jar typically.


I don’t understand your problem


by default, if you do lein install, you’ll make and install into your local artifact repo a jar with the files from the :source-paths and :resource-paths


If you don’t set those, that defaults to the 2 directories "src" and "resources"


If you want to deploy, you do lein deploy, but there are options there depending on how/where you are wanting to deploy it


I don’t see you asking for anything beyond the basic operations built into lein, unless you have some more specific requirement here


Not sure which lein -v you are using, but using 2.8.3 here as an example, read through


However, sounds like you may need more background than that, so read perhaps several of the files there under that doc/ dir in the repo.

Yehonathan Sharvit14:06:44

I am in a cljs project

Yehonathan Sharvit14:06:38

Here is my project.clj:

(defproject klipse "7.9.0"
  :description "Embeddable multi-language WEB REPL"
  :license "GPL-3.0"
  :url ""
  :resource-paths ["src"]
;  :resource-paths ["scripts" "src" "resources" "target"]
  :min-lein-version "2.8.1"
  :middleware [lein-tools-deps.plugin/resolve-dependencies-with-deps-edn]
  :lein-tools-deps/config {:config-files [:install :user :project]}
  :plugins [[lein-cljsbuild "1.1.7"]
            [lein-hiera "0.9.5"]
            [lein-tools-deps "0.4.1"]]
  :clean-targets ^{:protect false} ["targets"]
  :hiera {:path "deps-graph.png"
          :vertical true
          :show-external false
          :cluster-depth 2
          :trim-ns-prefix true}
  :cljsbuild {:builds {:plugin {:source-paths ["src/klipse/run/plugin"]
                                :compiler {
                                           :output-to "resources/public/plugin/js/klipse_plugin.js"
                                           :output-dir "resources/public/plugin/js"
                                           :pretty-print false
                                           :optimize-constants true
                                           :static-fns true
                                           ;:elide-asserts true
                                           :closure-defines {klipse.core/version
                                                             ~(->> (slurp "project.clj")
                                                                (re-seq #"\".*\"")
                                           :optimizations :simple
                                           :verbose false}}
                       :plugin-prod {
                                     :source-paths ["src/klipse/run/plugin_prod"]
                                     :compiler {
                                                :output-to "resources/public/plugin_prod/js/klipse_plugin.min.js"
                                                :output-dir "resources/public/plugin_prod/js"
                                                :pretty-print true
                                                :elide-asserts false
                                                :optimizations :advanced
                                                :closure-defines {klipse.core/version
                                                                  ~(->> (slurp "project.clj")
                                                                     (re-seq #"\".*\"")
                                                :verbose true}}}})

Yehonathan Sharvit14:06:58

For some reason, when I run lein install the generated jar is huge (around 11G)

Yehonathan Sharvit14:06:15

I cannot understand why. Any idea @mikerod @lukaszkorecki?


@viebel there is a lot involved here, so I won’t be able to answer why you’d get a large size. You could open the jar and see what things in it are large.


I do think that in your :compiler options in :cljsbuild it is odd you have :pretty-print true, while doing :optimizations :advanced, but I’m not even sure the cljs compiler would do anything about that. I think it’d ignore the :pretty-print option (should be false).


Overall though, too many unknowns. Look in the jar and see what is being included. It’s probably some really large JS stuff or something from your dependencies. Maybe the :hiera img stuff too


I also don’t understand your goals. You mentioned earlier that you only wanted to include the “src”. I don’t see how that’d work for someone necessarily.

Yehonathan Sharvit15:06:05

The jar is so big that it take ages to open


you can just extract it. then look around the extracted contents


not sure how you are you trying to open it

Yehonathan Sharvit16:06:10

I use :lein-tools-deps/config {:config-files [:install :user :project]} which overrides :resources-path with its value from deps.edn


yeah, I’ve nevered used this in lein, so that could make sense to me