I was thinking for lein projects, lein has a task to make a compatible pom.xml, but not to make a deps.edn I believe
if you mean how to convert lein -> deps I used https://github.com/hagmonk/depify
What is the proper way of invoking:
clojure -Sforce -A:backend:backend/prod:backend/build -X:backend/build
Can this be squashed into one -X:...
? Of which alias is the exec fn chosen?What was the option again to specify a different local mvn .m2 dir?
:mvn/local-repo
You can combine, will use the last one iirc
@alexmiller Is this a documented option? I couldn't find it
It’s part of the deps.edn, not a clj option
If I run clj -M -m <http://path.to.my|path.to.my>.main.ns
lots of dependencies are downloaded. I thought running clojure -Spath
beforehand would fetch those dependencies, but it doesn’t seem to do so?
I know, but any reason this is not part of guides or references for deps_and_cli?
No, I think it’s just an oversight
I can add it
@simongray I think it would need to fetch those deps in order to calc the classpath, no?
You would think so, but it doesn’t seem to do that. The clojure -Spath
runs inside a Docker container, so perhaps something is amiss
repro or it didn't happen :)
kinda in the middle of a bunch of changes :S
Also, maybe someone can tell me why you need to do -M -m
? Or should I do -X
now instead (the docs seem to use that now)?
Or was it -X -x
? :thinking_face: :troll:
Or maybe -M -x 😛
M x
of course!
all paths lead to emacs
{:emacs {:replace-paths ["emacs"]}}
clojure -Spath -A:emacs
M x clojure
hah
Solved: I didn’t set the WORKDIR in the Dockerfile before running clojure -Spath
so there was no deps.edn
to fetch download depencies according to.
I was trying to find that the other day in response to someone’s new-to-tools-deps question. It would be nice if the docs were also a little clearer that :mvn/repos
and :mvn/local-repo
can only be used at top-level keys and not inside aliases — that seems to be a fairly common confusion for some folks.
:thumbsup:
@ddouglass Another option could be having subcommands instead of dashed options.
clojure -A:foo:bar exec <exec-fn>
clojure -A:foo:bar main <foo.bar>
clojure -A:foo:bar path ;; print classpath
clojure -A:foo:bar run <tool>
clojure -A:foo:bar pom ...
so just one option to "compose" the classpath and subcommands that handle what should be done (with their own arg parsing and help output)
ya, i'm more preferential to that option b/c i think the current -A|M|X
options are a bit overloaded which bring up questions (like your's earlier) like "which alias does exec-opts come from", etc.
same thing for -S*
: some are commands (`-Stree`) while some are options (`-Scp cp`)
In the case of
clojure -A:foo:bar exec <exec-fn>
you would still have the ambiguity of where the exec-fn
could come from (the last alias?)mmhmm
It’s not ambiguous - there is a merge strategy defined for each
I mean, from the point of the ignorant consumer of this CLI
oh sure, it might be inscrutable :)
but generally I think <hand-wave> last one wins <hand-wave/> is what you expect most
I’m a bit confused about something. I have a deps.edn
with :paths ["src"]
, but clojure.tools.namespace.repl/reset
doesn’t work unless I (clojure.tools.namespace.repl/set-refresh-dirs "src")
. Checking (clojure.java.classpath/classpath-directories)
returns '()
. I guess my expectation was that this would be set using :paths
?
repl is started using cider via /usr/local/bin/clojure -A:dev -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.3"} refactor-nrepl/refactor-nrepl {:mvn/version "2.5.1"} cider/cider-nrepl {:mvn/version "0.25.9"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
clojure -Spath
prints src:resources:<...rest>
@mail024 My advice would be to try to ween yourself off the t.n.r reset/reload workflow and develop a “better” REPL workflow that doesn’t need that sort of thing, i.e., eval’ing every change you make as you go so the REPL state is always fresh. I see a lot of people get into all sorts of problems with “reloaded” style workflows 😞 and folks like Eric Normand, Stu Halloway, Rich Hickey, myself, and many others avoid this sort of tooling.
(but it does sound like a but in java.classpath
since src
and resources
are on the classpath and are directories — you could create a post on http://ask.clojure.org tagged with the java.classpath
library and see what the library maintainers say)
I would also recommend trying to repro in a plain REPL started yourself — without all that nREPL/CIDER stuff — and see if the problem persists: it’s entirely possible that something in nREPL/CIDER is causing this problem…
@seancorfield Thanks. Appreciate the advice. Guess it’s an old habit. Will give the suggested approach a spin, been meaning to try life without ns refresh for a while now
I’m thinking it might actually be a cider thing. plain repl has the expected entries in classpath-directories
I haven’t used nREPL or CIDER for a very long time so I would only point you to #cider at this point 🙂
(I use a plain Socket REPL with no additional dependencies)