This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-05
Channels
- # 100-days-of-code (1)
- # announcements (9)
- # aws (1)
- # beginners (195)
- # braveandtrue (60)
- # calva (3)
- # cider (36)
- # cljs-dev (3)
- # clojure (124)
- # clojure-canada (13)
- # clojure-dev (18)
- # clojure-germany (2)
- # clojure-italy (2)
- # clojure-losangeles (1)
- # clojure-nl (9)
- # clojure-russia (1)
- # clojure-spec (20)
- # clojure-uk (109)
- # clojurescript (49)
- # core-logic (29)
- # cursive (7)
- # datomic (62)
- # defnpodcast (1)
- # devcards (11)
- # docker (3)
- # duct (6)
- # figwheel (13)
- # figwheel-main (57)
- # fulcro (2)
- # graphql (11)
- # hyperfiddle (3)
- # jobs (5)
- # jobs-discuss (9)
- # leiningen (2)
- # lumo (1)
- # off-topic (12)
- # onyx (2)
- # pedestal (1)
- # portkey (2)
- # rdf (1)
- # re-frame (39)
- # reitit (13)
- # remote-jobs (2)
- # rum (5)
- # shadow-cljs (82)
- # tools-deps (48)
- # unrepl (3)
- # vim (12)
- # yada (1)
Hey there, everyone... I am a little lost, but probably just being stupid; I want to create an uberjar from my tools-deps based application. Any clues, links, etc..? (My Google-Fu has failed me completely)
@dominicm - Which Jar approach would you recommend via Pack for Docker-based deployment..?
@maleghast I recommend capsule as a good default 🙂
@dominicm - I may be doing something stupid (very likely), but on running the following:
clj -A:pack mach.pack.alpha.capsule foundation.jar -e build-dir --application-id foundation --application-version "$(git describe)" -m foundation.main
I can find the file -> mach.pack.alpha.capsule <- but not my jarfile... 😞@dominicm I get / got this -> https://gist.github.com/maleghast/b671e5299d709c79813ca80b4a81f7bd
I copied your command from the Pack Github page and just changed the name of the output jarfile and the app main namespace (it's up there ^^)
:pack {:extra-deps
{pack/pack.alpha
{:git/url ""
:sha "1d455f6c591f440560c57a29e6d930004d735dcf"}}
:main-opts ["-m" "mach.pack.alpha.capsule"
"-m" "foundation.main"]}
@maleghast I recommend you to stay with lein for some time. pack.alpha, depstar and other have some lacks... one of them copy src files into uberjar, another doesn't copy resource folder into uberjar. I've investigated all of them and IMO lein is still preferable way to build uberjar.
pack does put src files in, because that's what you generally want. If you want to AOT, that is supported with pack, but you do it as an earlier step. I'm happy to point you at how you can do this, and we're working on improving the documentation to make it much clearer on how to do this kind of thing.
please point 🙂
@maleghast most promising tool is https://github.com/luchiniatwork/cambada
Thanks @mike1452 I will take a look... The app I am trying to UberJar is built on top of a library that @dominicm works on, that uses tools.clojure and deps.edn and as such uses neither leiningen or boot, and I am loath to add either into the mix if I don't have to. That being said, if I have to...
this works:
clj -A:pack foundation.jar --application-id foundation --application-version "$(git describe)" -m foundation.main
@dominicm - yeah, that does work... However I need to figure out how to package up the CSS etc. as the app is functioning, but looks AWFUL 😉
@maleghast yeah, I figured that the alias you had already had the mach.pack.alpha.capsule
in the alias 🙂
@maleghast the -e build_dir
option is a flag to provide an extra directory to be combined into the jar. So you can build your css/js into a directory, and have it run.
If you're using edge, there's an uberjar script in master which has these steps in 🙂
Made a script for grepping in your classpath: https://gist.github.com/pesterhazy/74f6bc235dfe5f64690250d2ee84969d
e.g. clojure -Spath | unpack-cp
, then cd
to that directory and run grep from there
@dominicm Did you use pack/pack.alpha? can't understand how to avoid copying source files into uberjar using this tool
Well it depends. I think it should as parameter, like lein does ( :omit-source true) . When I put my uberjar in external untrusted environment I don't want that my source files be availabale for other people.
I haven't looked into that kind of use case particularly, but I understand now. Skipping the :paths
seems like a possible flag that can be added though, it shouldn't be too difficult.
Yeah. It would be great.