Reputation: 8654
Im working on compiling jars from a local repository in leiningen. This works in my project.clj:
:repositories {"local" ~(str (.toURI (java.io.File. "local_mvn_repo")))}
but this fails:
:repositories [["local" (str (.toURI (java.io.File. "local_mvn_repo")))]]
$ lein deps
java.lang.UnsupportedOperationException: nth not supported on this type: Symbol
Even though the latter looks in compliance with the official example. My question is this:
What does the ~ do above, which do I need it, and why can't i use the vector form?
Upvotes: 3
Views: 879
Reputation: 91534
The ~ is the unquoting function in this case, it tells lieningen to run the form after it and use the value produced by running it instead of trying to use it directly.
The first example if the format for Leiningen version 1.x while the second from is the newer form and is failing because it is missing the ~
and some { }
:repositories [["local" {:url ~(str (.toURI (java.io.File. "local_mvn_repo")))}]]
ps: I'm not sure if the map form is required and I'm assuming you are using lein2
Upvotes: 3