This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-18
Channels
- # aws (1)
- # babashka (35)
- # beginners (52)
- # biff (4)
- # calva (55)
- # cider (19)
- # clojure (54)
- # clojure-dev (3)
- # clojure-europe (23)
- # clojure-nl (1)
- # clojure-norway (3)
- # clojure-uk (2)
- # clojurescript (9)
- # code-reviews (3)
- # datahike (1)
- # fulcro (1)
- # funcool (4)
- # graalvm (21)
- # gratitude (2)
- # java (5)
- # jobs (2)
- # joyride (1)
- # kaocha (13)
- # malli (2)
- # off-topic (22)
- # other-languages (11)
- # pathom (4)
- # re-frame (35)
- # reagent (3)
- # reitit (3)
- # releases (2)
- # remote-jobs (1)
- # rum (1)
- # shadow-cljs (42)
- # sql (18)
- # tools-deps (72)
- # web-security (6)
- # xtdb (15)
hello, i've done some searching but couldn't find an answer.
i've got a bb.edn file with a :deps
key which is all fine - on CI the dep gets pulled in and it all works.
locally i recently deleted my .m2 directory because it got corrupted. babashka seems to think the deps are still there, because it doesn't attempt to download them and just blows up when running the script at the point it calls require
on the dep. has it cached somewhere what it thinks is in my .m2 repo already?
many thanks
try deleting the .cpcache
dir beside the bb.edn
thanks for the suggestion - unfortunately doesn't work. i even deleted the entire repo and re-cloned it to get a completely fresh checkout and it still doesn't work 😞
could you paste the error youre seeing?
bb.edn looks like this
{:paths ["src"]
:deps {org.babashka/cli {:mvn/version "0.2.16"}}}
file looks like this
(ns foo
(:require [babashka.cli :as cli]))
and the error i get is
Type: NoSuchFileException
Message: ~/.m2/repository/org.babashka/cli/cli-0.2.16/0.2.16.jar
Location: ~/project/src/foo.clj
thanks @U04V15CAJ i will try those
Hello can I check if the bb process is running a repl? I would like to exit my script on error but not while developing
@benjamin.schwerdtner You can do this:
(throw (ex-info "O no!" {:babashka/exit 1}))

Awesome that bb can "just do that".
For Clojure, I have this much bulkier solution, with the body of in-repl?
mostly stolen from a StackOverflow answer. Makes a stack trace and checks that for some stack elements that should exist iff in a repl.
I then have shutdown
and die
functions which print exit messages (with`die` binding *out*
to *err*
), and then pass an exit code to`exit`.
(defn in-repl? []
(let [stack-trace (.getStackTrace (Thread/currentThread))
repl-stack-element?
(fn [elem] (and (= "clojure.main$repl" (.getClassName elem))
(= "doInvoke" (.getMethodName elem))))]
(some repl-stack-element? stack-trace)))
(defn exit [exit-code]
(if (in-repl?)
(println "-Aborting exit ( code " exit-code ") triggered by eval in REPL.")
(System/exit exit-code)))
I am using portal with the output of yaml/parse-string but the default viewer just shows
#ordered-map ()
instead the nice expanded display you get with edn. When I use this with clojure it looks a lot better
;;
(def ^:private ipm-print-method
(get (methods print-method) clojure.lang.IPersistentMap))
(defmethod print-method OrderedMap [o ^java.io.Writer w]
(.write w "#ordered/map ")
(ipm-print-method (seq o) w)))
I guess this would mean adding that class to babashkait's not a big thing but I guess most yaml derived data will have this issue. Wondering if anyone has a better solution.
If a Java class isn't included in Babashka, it seems like my two options are recompiling Babashka with the class or creating a pod. Am I missing an option?
Like, it depends if the class is generally useful enough for bb, we could also include it, but if it's pretty niche, then yes, those are the options you have with bb
The class is part of Cucumber-JDK. I don't think it's widely applicable to Clojure projects.
hmyeah. what would be the purpose of adding it to bb? something kaocha related? there is also things like https://www.npmjs.com/package/@cucumber/cucumber which you could use with #nbb (the Node.js variant of bb)
That's a good idea. I'm looking to add building our Cucumber feature docs to our Babashka tooling for releasing Kaocha
Just merged a commit to master which makes tools.namespace and cognitect test runner work with bb as is, so I can deprecate https://github.com/babashka/tools.namespace