This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-21
Channels
- # adventofcode (27)
- # announcements (2)
- # babashka (1)
- # beginners (111)
- # calva (11)
- # cider (82)
- # clara (6)
- # clojure (44)
- # clojure-dev (5)
- # clojure-europe (27)
- # clojure-nl (5)
- # clojure-spec (3)
- # clojure-uk (3)
- # clojurescript (29)
- # core-async (5)
- # cursive (4)
- # datalevin (1)
- # datomic (39)
- # exercism (4)
- # figwheel-main (1)
- # fulcro (32)
- # graalvm (7)
- # gratitude (1)
- # integrant (4)
- # jobs (1)
- # lein-figwheel (3)
- # leiningen (4)
- # lsp (3)
- # luminus (3)
- # meander (2)
- # nextjournal (1)
- # off-topic (10)
- # other-languages (26)
- # pathom (14)
- # polylith (9)
- # re-frame (16)
- # remote-jobs (1)
- # shadow-cljs (4)
- # specter (2)
- # sql (6)
- # timbre (2)
- # tools-build (12)
- # xtdb (9)
Hello all, I see the difference btw depstar and tools.build, from depstar I see clj
non .class generated and from tools.build I see the .class
references for .clj
. To the application, what is the impact of it?
The configuration is
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.7.2" :git/sha "0361dde"}}
:ns-default build}
:uberjar {:replace-deps {com.github.seancorfield/depstar {:mvn/version "2.1.297"}}
:exec-fn hf.depstar/uberjar
:exec-args {:aot true
:jar "myjar.jar"
:main-class "my-app.core"}}
https://clojure.org/reference/compilation this article covers most of the differences.
I nether use aot to package my applications. It usually complicate things. But if you think one of the reasons given in the first section of the article is relevant to you - you can try it out. Problems (if any) should pop up right away
Clojure code must be compiled to classes to be loaded by the jvm. This is either done on demand at runtime or ahead of time and saved in your uberjar. Doing the latter will make your app load faster as that work is done already
If both are included, the compiler classes are preferred
@U0YJJPFRA If you use my build-clj
wrapper for tools.build
, it will AOT compile your main namespace and since AOT is transitive, that will generally compile "everything". The build-clj
equivalent to what you were doing with depstar
would be something like:
(ns build
(:require [org.corfield.build :as bb]))
(defn uberjar [opts]
(bb/uber (merge {:main 'my-app.core :uber-file "myjar.jar"} opts)))
Then you'd run clojure -T:build uberjar
and you can provide any tools.build
options you want for the compile
and uber
steps (and influence the copying steps too).build-clj
is intended to provide sane defaults for the various tools.build
functions and to simplify your build.clj
file -- it's a very thin wrapper 🙂
@U04V70XH6 Thank you, I´ll try it