This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-25
Channels
- # announcements (3)
- # asami (63)
- # babashka (5)
- # babashka-sci-dev (32)
- # beginners (56)
- # calva (2)
- # cider (28)
- # clj-commons (9)
- # clj-kondo (16)
- # cljdoc (41)
- # cljs-dev (19)
- # clojure (67)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-uk (2)
- # clojurescript (27)
- # community-development (10)
- # data-science (2)
- # datascript (8)
- # datomic (21)
- # events (3)
- # fulcro (54)
- # graalvm (18)
- # introduce-yourself (2)
- # juxt (3)
- # lsp (6)
- # music (1)
- # nextjournal (8)
- # off-topic (44)
- # omni-trace (1)
- # reitit (13)
- # releases (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # spacemacs (6)
- # sql (12)
- # tools-build (17)
- # tools-deps (3)
- # web-security (1)
Hi! I am just starting with tools-build and kind of lost. I have two questions:
1. Is it correct that I need to manually install build tools with clj -Ttools install io.github.clojure/tools.build '{:git/tag "v0.7.5" :git/sha "34727f7"}' :as build
? (Before that, I got "Error building classpath. Unknown tool: build")
2. Why do I need to manually activate the build alias, is it not activated automatically? This clojure -A:build -Tbuild jar
works in my project but clojure -Tbuild jar
fails with "Unqualified function can't be resolved: jar"
Thank you!
Typically you would just add a :build
alias to your deps.edn
and then invoke it using clojure -T:build uber
I made a CLI called https://github.com/babashka/neil which allows you to set this up very quickly:
neil add build
This creates build.clj
and the build alias in your deps.edn using the newest tools.build version. You can immediately execute clojure -T:build uber
after that.Note that -T:foo
and -Tfoo
are two different things: the one without the colon is executing a globally installed tool, while the first is executing a tool in the alias of the deps.edn.
The : is the culprit. Thank you!
Though no, I am actually trying to exec a globally installed tool
Imo it's more reproducible to depend on a specific version of tools build in your project than rely on a globally installed one
You are of course right
I should have simply executed clojure -T:build jar
in my project, which works. I was confused b/c I have installed build globally - though perhaps I should not have done that.
I read parts of the build guide but obviously have not grokked it and I overlooked the crucial difference between Tbuild and T:build
Thank you so much!
I expect that little colon confuses many people @U0522TWDA!
Hi, I’m working on a uberjar build for my project using the example code at https://clojure.org/guides/tools_build as a basis and I have a question related to the classpath. I understand that when you run the build alias as with -T
from clojure that the default :deps
in deps.edn
are ignored, but does that mean that you must laboriously define the same (or slightly tweaked) list of library dependencies within the build alias again, or is there a more idiomatic way to accomplish this? Thanks in advance.
Our of topic but you could use our be inspired by https://github.com/seancorfield/build-clj
No, the basis built in tools.build uses the project :deps by default
Thanks for the quick response. Yes indeed, that’s the case. I was being thrown by a ClassNotFoundException related to a misconfiguration of my :paths
in my deps.edn. Once I fixed that everything works. Thanks again.
All the examples in the guide are doing this
That is, the build is a program and that program does not need your deps. It uses the deps.edn as data to construct the set of libs (the basis) used to include in the uberjar