babashka

agorgl 2025-10-13T10:31:42.727759Z

Hello! When I tried to run a babashka script with the relevant babashka/babashka container image, I got an error that (deps/add-deps) couldn't find java. I suppose that this functionality depends on the jvm? Are there any (official) container images that contain both babashka AND the jvm/jdk?

borkdude 2025-10-13T10:32:58.219959Z

@agorglouk Yes, add-deps depends on the JVM. There are no official images that include the JVM. Easiest would probably be to make your own or grab a JVM image and install bb inside of that

agorgl 2025-10-13T10:33:16.458409Z

will do that thank you 🙂

Tomas Brejla 2025-10-13T11:34:46.159679Z

..that means NOT running the graalvm-native-compiled babashka in such docker image, right? Ie: running "jar" version of babashka using full-blown jvm.

borkdude 2025-10-13T11:37:03.838019Z

no?

borkdude 2025-10-13T11:37:28.214179Z

I mean: yes, it does NOT mean that

Tomas Brejla 2025-10-13T11:39:14.853409Z

> I mean: yes, it does NOT mean that beauty of logic 🙂 So does that mean that natively-compiled babashka can benefit from having real jvm installed in the same container in that sense, that you will be able to call deps/add-deps?

borkdude 2025-10-13T11:40:10.955039Z

yes. but... in the optimal case you do this in a pre-final build stage so you don't actually need the JVM at runtime in the image

Tomas Brejla 2025-10-13T11:42:56.655129Z

Interesting. It never occured to me that native bb can use real jvm. I thought that statically compiled (native-image) graalvm binaries don't support class loading... so I still don't see how native bb can use real jvm. (other than "fork javac process and then stare silently on the generated .class file which you unfortunately can't load" 😅 )

borkdude 2025-10-13T11:46:15.275819Z

babashka add-deps doesn't support class-loading. it just supports running a bb compatible library from mvn, git deps, etc.

1
borkdude 2025-10-13T11:46:19.006019Z

same as bb.edn

borkdude 2025-10-13T11:48:08.330099Z

the reason the JVM is used is that tools.deps is invoked

Tomas Brejla 2025-10-13T11:48:51.844129Z

Oh, I see. Makes sense.

agorgl 2025-10-13T11:49:54.122719Z

that was gonna be my next question: i'm kinda fighting again with corporate proxies, but this time it gets worse because i do it inside a container. Could you describe in high level all the interdependencies of bb (when using add-deps) in order to understand what processes are being spawned that may need configuration bellow?

agorgl 2025-10-13T11:50:07.913659Z

(should I start a new thread about this?)

borkdude 2025-10-13T11:50:50.370569Z

this is used under the hood: https://github.com/borkdude/deps.clj proxy stuff is supported and documented in there

agorgl 2025-10-13T11:51:02.996409Z

I suspect that all of the bb/jdk/tools.deps/deps.clj/mvn are used together (chained somehow)

agorgl 2025-10-13T11:51:39.143889Z

yeah I've reached the part that bb calls deps.clj and I've seen the proxy setup of deps.clj

agorgl 2025-10-13T11:52:08.923409Z

artifact resolution through the proxy works, fetching the dependencies does not so far

borkdude 2025-10-13T11:52:12.816949Z

it might be far easier to just build an uberjar with your deps and then use that in your container?

agorgl 2025-10-13T11:52:42.096559Z

yes it would, I'm just trying to build a deeper knowledge around the bb ecosystem 🙂

agorgl 2025-10-13T11:55:16.526629Z

as far as I remember setting up the proxy in .m2/settings.xml will make it work, the question is why/how is mvn involved in the add-deps process

agorgl 2025-10-13T11:55:28.314139Z

I'm trying to pass around proxy configuration through environment variables

borkdude 2025-10-13T11:55:50.268879Z

if you are using mvn dependencies, then mvn is used per tools.deps

borkdude 2025-10-13T11:56:09.131009Z

I don't do any other magic around this, same as the clojure CLI

agorgl 2025-10-13T11:56:54.937869Z

ah it seems that the chain is bb -> deps.clj -> tools.deps

agorgl 2025-10-13T11:57:07.138229Z

deps.clj just spawns a clojure subprocess am I correct?

borkdude 2025-10-13T11:59:45.976629Z

true

borkdude 2025-10-13T12:00:07.052089Z

deps.clj is just basically a rewrite of the clojure CLI bash script to clojure itself

borkdude 2025-10-13T12:00:20.237449Z

and should behave the same way (barring some extra features like proxy support!)