Fork me on GitHub
#tools-deps
<
2021-09-06
>
wactbprot07:09:55

Hi, I try to build a compiled uberjar application using tools.build. I follow the https://clojure.org/guides/tools_build and end up with this error message at clj -T:build uber step:

Execution error (IllegalArgumentException) at repliclj.conf/get-config (conf.clj:12).
Cannot open <nil> as a Reader.
which points to the line:
(get-config (io/resource "config.edn"))
The config.edn file is in the directory resources. I guess
(b/copy-dir {:src-dirs ["src" "resources"] :target-dir class-dir})
copies the file to target/classes/ where io/resource don't find it. Any advice is very welcome.

hiredman07:09:38

io/resource should find it fine classes, assuming ./classes/ is on the classpath, which is how things have to be setup for aot compilation anyway

hiredman07:09:45

Did you call the prep function as shown in the examples?

wactbprot07:09:31

Yes, I followed the steps.

hiredman07:09:19

I would look in ./classes to see if config.edn is in there

hiredman07:09:41

If it is in there, it means something is wrong with compiling and ./classes is not on the classpath like if needs to be, if it isn't in there it means resources/ was not properly copied

wactbprot08:09:54

config.edn is not in ./classes but in ./target/classes/ . The guide gives (def class-dir "target/classes") So, what can I do to ensure that the file is properly copied?

wactbprot08:09:06

I just noticed that ./classes is not created by the tools.build process, but by Seans -X:uberjar which works btw. This means that I don't have a ./classes folder in the tools.build process.

hiredman08:09:40

Sorry, target/classes is likely correct there for tools.build

hiredman08:09:42

There is a #tools-build channel maybe this should move to