Fork me on GitHub
#clojure
<
2023-04-29
>
Drew Verlee02:04:33

[solved] How do i tell clj about a local library if not by using the file path syntax "/path/to/lib" This error (below in the code block) indicates that it doesn't respect ~/ aka home. I want to keep my dev libs in one place and have other projects pick them up, so it can't be "relative" to the project I'm starting the repl in.

clj -A:developer-libraries
Error building classpath. Local lib developer-libraries not found: /home/drewverlee/clojure/try/add-lib/~/clojure/utils
Some options 1. ~ isn't the right way to do this, and I'm a file path dummy 2. using a clojure alias isnt' the right way to do this and i should use blah 3. ????

daveschoutens02:04:14

If you drop the / path prefix, what does it resolve to? (I'd try it myself but not at computer 😁)

Drew Verlee02:04:36

it will give fail to find something on /clojure/utils, which is fine, because i can use /home/drewverlee/clojure/utils. I forgot vanilla / was an option.

Drew Verlee02:04:02

or at least, i was juggling too many things to remember it in this context...

Ben Lieberman03:04:19

The JVM doesn't expand ~

practicalli-johnny07:04:10

As ~ is a shell (bash, zsh fish) expansion, a path containing ~ would need to be used as a command line argument which the shell will expand before passing to the Clojure tool (jvm). In theory that would work for clojure.main as it uses string arguments, but maybe more involved for clojure.exec as it uses EDN style arguments Using an with the full path seems to be the simplest & most reliable approach, unless the approach is being used on different operating systems & user accounts (but then it's not really local anymore)

👍 2