This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-13
Channels
- # announcements (6)
- # babashka (96)
- # beginners (159)
- # calva (16)
- # cider (17)
- # clj-kondo (4)
- # cljdoc (6)
- # cljfx (3)
- # clojure (202)
- # clojure-europe (21)
- # clojure-italy (2)
- # clojure-nl (36)
- # clojure-spec (6)
- # clojure-uk (16)
- # clojurescript (29)
- # conjure (25)
- # cursive (29)
- # data-science (12)
- # datalog (18)
- # datomic (58)
- # depstar (73)
- # duct (16)
- # emacs (65)
- # events (3)
- # fulcro (8)
- # honeysql (12)
- # jackdaw (6)
- # jobs (7)
- # jobs-discuss (3)
- # kaocha (50)
- # leiningen (8)
- # lsp (14)
- # malli (83)
- # meander (34)
- # off-topic (2)
- # polylith (4)
- # proletarian (7)
- # re-frame (8)
- # releases (9)
- # remote-jobs (3)
- # shadow-cljs (101)
- # sql (1)
- # tools-deps (48)
- # vim (7)
- # xtdb (13)
- # yada (14)
I’m moving from a lein project to tools deps.edn and unfortunately I had some “injections” in my project.clj
Is there a way to “inject” (i.e. require) some namespace when using the https://github.com/cognitect-labs/test-runner?
thanks,
The problem is that when using multiple aliases only the last main-opts
in is kept. So I don’t see how can I add this to my deps.edn
to be permanent.
For example a good place for such thing would have been under alias called
:my-lib-test
yeah but then I can’t use my :runner
alias for all tests.
:runner {:extra-deps ...
:main-opts ["-m" "cognitect.test-runner"]}
and I’ll need to create a different alias for each library that needs this “injection”. This will also be a bit more complicated because I’m also building the CI integration and trying to have some code re-use.
Eventually I forkedhttps://github.com/localizedev/test-runner and added support as another command line argument…I don’t understand why deps.edn doesn’t allow to dynamically evaluate some clj expression. This quite limits the flexibility of deps.
isn't that what -M -e does?
if not, what do you mean?
I’ve a deps.edn file, I want to set the :mvn/local-repo to be :mvn/local-repo=$SOMEPATH, where $SOMEPATH is an environment variable
I can do things like reading a template file and output a deps.edn. Just found it is a little bit unnecessary as deps doesn’t support these functionalities.
can you do it with stdin?
oh sorry, you're talking about in deps.edn
you can pass that particular case on the command line with -Sdeps
I think I might hack the PATH and use a wrapped verison of clj which automatically adds -Sdeps.
Anyone knows if it is possible to add -e "(require 'sc.api)"
to IntelliJ’s Run Configuration?
can’t you add it in an additional alias?
Ideally, I would follow scope-capture’s recommendation and keep it outside the project. (https://github.com/vvvvalvalval/scope-capture)
But if that’s not possible, I could add an alias.
I tried to add it to my server
alias, which already has a :main-opts
:
:main-opts ["-m" "dvp.clj.server"]
Tried with
:main-opts ["-m" "dvp.clj.server" "-e" "(require 'sc.api)"]
but to no success.
But IntelliJ won’t even start the main function with my current alias, so maybe I need to figure out that first.Is the syntax correct, btw?
I think “-e” should come before. Check out https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn
Thanks 👍
It seems clojure -Spom
doesn’t add :local/root
dependencies to the final pom.xml
file.
Does anyone knows if this is a known issue?
does maven supports arbitrary path as a dependency?
the same happens with git-based dependencies
I see now..
The behavior I was expecting is to go into the path of the :local/root
and check if there’s a pom.xml
file and use its version. maybe a feature request? 🙂
I’m not sure how that even makes sense? :local/root
and :git/url
are source-only dependencies that don’t fit Maven’s group/artifact/version world — and pom.xml
doesn’t contain any information about transitive dependencies anyway.
indeed, my usage is wrong. actually this behavior makes sense. this is not a Spom problem.
there is no way to do so?
You can't. deps.clj (unofficial) does support this: https://github.com/borkdude/deps.clj.
why do you want to ignore it?
if you have babashka installed, you can invoke it with bb clojure -Sdeps-file=other.edn
I am writing a simple script to transform a deps.edn file, basically add some entries.
#!/bin/sh
#_stub ; -*- mode: clojure; -*-
#_(
DEPS='
{:mvn/local-repo "", :deps {}}
'
exec clojure -Sdeps "$DEPS" -M "$0" "$@"
stub)
(require '[clojure.edn :as edn])
(def deps (edn/read-string (slurp "deps.edn")))
(def newdeps (assoc deps :mvn/local-repo "../../.m2"))
(spit "deps.edn" (pr-str newdeps))
I don't see why that requires you to ignore the deps.edn
I think you'd really want something wonkier like clj -Sdeps '{:aliases {:TMP {:replace-deps {} :replace-paths []}}}' -A:TMP
I see now..
The behavior I was expecting is to go into the path of the :local/root
and check if there’s a pom.xml
file and use its version. maybe a feature request? 🙂