leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
Yehonathan Sharvit 2019-06-19T06:42:37.024800Z

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

Yehonathan Sharvit 2019-06-19T13:15:17.025Z

Please help

2019-06-19T14:10:52.025300Z

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

Yehonathan Sharvit 2019-06-19T14:11:35.025900Z

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

2019-06-19T14:12:11.026100Z

As a jar typically.

2019-06-19T14:12:24.026300Z

I don’t understand your problem

2019-06-19T14:12:47.026900Z

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

2019-06-19T14:13:03.027400Z

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

2019-06-19T14:13:28.027800Z

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

2019-06-19T14:13:50.028300Z

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

2019-06-19T14:14:36.028700Z

Not sure which lein -v you are using, but using 2.8.3 here as an example, read through https://github.com/technomancy/leiningen/blob/2.8.3/doc/DEPLOY.md

2019-06-19T14:15:09.029500Z

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 Sharvit 2019-06-19T14:51:44.029700Z

I am in a cljs project

Yehonathan Sharvit 2019-06-19T14:52:38.030100Z

Here is my project.clj:

(defproject klipse "7.9.0"
  :description "Embeddable multi-language WEB REPL"
  :license "GPL-3.0"
  :url "<https://github.com/viebel/klipse>"
  :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
                                                             ~(-&gt;&gt; (slurp "project.clj")
                                                                (re-seq #"\".*\"")
                                                                (first))}
                                           :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
                                                                  ~(-&gt;&gt; (slurp "project.clj")
                                                                     (re-seq #"\".*\"")
                                                                     (first))}
                                                :verbose true}}}})

Yehonathan Sharvit 2019-06-19T14:52:58.030600Z

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

Yehonathan Sharvit 2019-06-19T14:53:15.031Z

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

2019-06-19T15:17:47.031800Z

@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.

2019-06-19T15:18:45.033Z

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).

2019-06-19T15:19:27.033700Z

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

2019-06-19T15:20:17.034300Z

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 Sharvit 2019-06-19T15:25:05.034900Z

The jar is so big that it take ages to open

2019-06-19T15:30:19.035100Z

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

2019-06-19T15:30:40.035500Z

not sure how you are you trying to open it

Yehonathan Sharvit 2019-06-19T16:12:31.035700Z

I found the issue

Yehonathan Sharvit 2019-06-19T16:13:10.036500Z

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

2019-06-19T16:29:33.036900Z

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