Fork me on GitHub
#tools-deps
<
2019-06-06
>
sveri07:06:25

How do I start a repl in a given namespace? I have not seen anything in the documentation about it.

sveri08:06:57

I figured I could use something like this:

:aliases
        {:cursive {:main-opts ["-e" "(load \"de/sveri/getless/user\")"
                               "-e" "(de.sveri.getless.user/reset)"]}}
It works, but is it the right way to use tools-deps?

Alex Miller (Clojure team)12:06:46

You would need to do something like this

Alex Miller (Clojure team)12:06:30

You could simplify to one expr by using requiring-resolve (added in 1.10)

Alex Miller (Clojure team)12:06:27

((requiring-resolve ‘de.sveri.getless.user/reset))

sveri12:06:49

@alexmiller Thanks, that works and looks better

Alex Miller (Clojure team)12:06:52

although double parens always looks weird

Jakub Holý (HolyJak)22:06:20

Is :local/root supposed to work for pointing to a local lein project (with a pom.xml)? Or only deps projects? Thanks! (It doesn't for me)

Alex Miller (Clojure team)22:06:37

it should work for deps.edn and pom.xml

Alex Miller (Clojure team)22:06:48

in what way does it not work?

Jakub Holý (HolyJak)09:06:25

E.g. REPL does not see the code from that project:

$ clj -A:test
Clojure 1.10.1-beta2
user=> (require '[clj-concordion.core :as cc])
Execution error (FileNotFoundException) at user/eval1 (REPL:1).
Could not locate clj_concordion/core__init.class, clj_concordion/core.clj or clj_concordion/core.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
with deps.edn including
{:aliases
 {:test
  {:extra-deps {clj-concordion {:local/root "/Users/me/Projects/clj-concordion"}
                ;clj-concordion {:local/root "/Users/me/Projects/clj-concordion/target/clj-concordion-0.0.5.jar"}
(the .jar works) and
$ head ~/Projects/clj-concordion/pom.xml
<?xml ...><project ...>
 <modelVersion>4.0.0</modelVersion>
  <groupId>clj-concordion</groupId>
  <artifactId>clj-concordion</artifactId>
...
  <build>
 <sourceDirectory>src</sourceDirectory>
...
and
$ head -n1 ~/Projects/clj-concordion/src/clj_concordion/core.clj
(ns clj-concordion.core
(Could there be a problem with using src/ instead of src/main/clojure/?)