Hi all:slightly_smiling_face:
I'm trying to build a graalvm native-image of my personal cli tool that uses https://github.com/grzm/awyeah-api. When I run the command with unberjar everything works, but when I run the same command with the binary I get:
> Exception in thread "main" java.io.FileNotFoundException: Could not locate com/grzm/awyeah/http/awyeah__init.class, com/grzm/awyeah/http/awyeah.clj or com/grzm/awyeah/http/awyeah.cljc on classpath.
When building the image, I do see the package is being registered:
[clj-easy/graal-build-time] Registering packages for build time initialization: clojure, babashka, cheshire, clj_easy, com.grzm.awyeah, mal
When I run jar -tf <my-jar> | grep com/grzm/awyeah/http/awyeah.clj I do see this file present.
My tool's setup is similar https://github.com/borkdude/jayfu setup, and was working fine till I've added the awyeah dependency.
Has anyone encountered this issue?
I suspect it's some graalvm-related configuration but I can't understand what.Can you upload your repo somewhere? I’ll take a look later today
@borkdude Unfortunately this repo is on my workplace private organization, but I'll create a minimal one now to reproduce the error. Thanks! BTW: I'm a huge fan and truly excited to converse with you:blush:
Hi, I've created some minimal repo (just need to invoke main to get the error): https://github.com/wanishing/awyeah-graalvm
@tal.vanish I think the issue is that those namespaces that are reported are lazily loaded
When you require them in the namespace of your main function, it might work
Do you mean adding this to my core.clj file?
(require '[com.grzm.awyeah.client.api :as aws]
'[com.grzm.awyeah.config :as config]
'[com.grzm.awyeah.credentials :as credentials])
It didn't work/-:What about: > com/grzm/awyeah/http/awyeah
that you reported earlier
btw, it's possible to use this library from babashka as well, if you want fast startup
I didn't now that. How can I use it?
I've added com.grzm.awyeah.http.awyeah and com.grzm.awyeah.protocols.rest-xml to my main namespace and it did work! thank you dearly:pray:
@tal.vanish You can use it from babashka the same way you would use it with clojure, like this: https://github.com/grzm/awyeah-api#bbedn
Got it:) Thank you again I don't think I would have come up with this solution any time soon