Fork me on GitHub
#graalvm
<
2022-12-16
>
Wanishing11:12:42

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.

borkdude12:12:44

Can you upload your repo somewhere? I’ll take a look later today

Wanishing12:12:25

@U04V15CAJ 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:

❤️ 1
Wanishing12:12:54

Hi, I've created some minimal repo (just need to invoke main to get the error): https://github.com/wanishing/awyeah-graalvm

borkdude13:12:07

@U04FGP6EJ20 I think the issue is that those namespaces that are reported are lazily loaded

borkdude13:12:08

When you require them in the namespace of your main function, it might work

Wanishing13:12:58

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/-:

borkdude14:12:03

What about: > com/grzm/awyeah/http/awyeah

borkdude14:12:09

that you reported earlier

borkdude14:12:04

btw, it's possible to use this library from babashka as well, if you want fast startup

Wanishing14:12:34

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:

👍 1
borkdude14:12:04

@U04FGP6EJ20 You can use it from babashka the same way you would use it with clojure, like this: https://github.com/grzm/awyeah-api#bbedn

Wanishing14:12:42

Got it:) Thank you again I don't think I would have come up with this solution any time soon