Fork me on GitHub
#tools-deps
<
2023-02-12
>
Jesús Gómez13:02:59

Hello. What is the current way to require the function add-lib or add-libs these days? https://insideclojure.org/2018/05/04/add-lib/

practicalli-johnny14:02:26

This is how I hotload for libraries, using a rich comment block. It could also be done in the deps.edn file but I prefer the rich comment https://practical.li/clojure/clojure-cli/projects/hotload-in-project/

👍 1
Jesús Gómez14:02:24

Thank you very much. Kind of an aside, but I notice that the page of tools.deps.alpha say it is obsolete and tools.deps should be used[1], but I didn't find add-libs in tools.deps (maybe I didn't search enough). Do you know if the function add-libs is part of tools.deps namespace somewhere, maybe a sub namespace I'm not finding? [1] https://github.com/clojure/tools.deps.alpha

practicalli-johnny14:02:49

As I understand it, tools.deps should be used for everything, except add-libs which has not yet been finalised (although it hasnt changed much in the last year). So just for add-libs, use tools.deps.alpha until Alex is kind enough to find time to finalise the add-libs feature and include it in tools.deps or there preferred way to package it.

👍 2
Jesús Gómez14:02:58

Now I understand. Thank you very much!

practicalli-johnny14:02:15

Thanks, I just noticed that too... the book is being refactored and I'm working on improviing that bit today and expanding on hotloading and other tools for a REPL reloaded page... the left hand navigation should all work though...

👍 2
1
skylize15:02:22

Based on recent comments here from Alex, add-libs should probably be out of alpha pretty soon, I think.

Alex Miller (Clojure team)16:02:32

indeed, there will be an official way to do this soon (but it will not be in tools.deps at all)

❤️ 6
Jesús Gómez15:02:37

What happens when I include many aliases and each one has main-opts? Which of those libraries' main methods will be called and with what main-opts?

clj -M:alias-1:alias-2:...:alias-n

practicalli-johnny15:02:31

In a chain of aliases, only the last :main-opts definition is used, so in the example only :main-opts from :alias-n

Jesús Gómez15:02:21

Thank you!

👍 2
Jesús Gómez15:02:04

I found the doc reference of this information: https://clojure.org/reference/deps_and_cli#_execution (Regarding :main-opts) "If multiple maps with these keys are activated, only the last one will be used"