This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-02
Channels
- # announcements (11)
- # aws (3)
- # babashka (34)
- # beginners (20)
- # biff (2)
- # calva (3)
- # cherry (29)
- # cider (6)
- # cljs-dev (9)
- # clojure (124)
- # clojure-europe (12)
- # clojure-norway (5)
- # clojure-uk (2)
- # clojurescript (32)
- # conjure (11)
- # datalevin (1)
- # datomic (16)
- # deps-new (1)
- # etaoin (6)
- # holy-lambda (10)
- # honeysql (28)
- # hyperfiddle (21)
- # jackdaw (2)
- # jobs (2)
- # leiningen (15)
- # missionary (12)
- # off-topic (132)
- # other-languages (1)
- # pathom (13)
- # rdf (10)
- # re-frame (8)
- # reagent (5)
- # releases (1)
- # remote-jobs (4)
- # shadow-cljs (32)
- # tools-deps (6)
- # vim (15)
- # xtdb (24)
Is it possible to have different :source-paths
? And then to combine these :profiles
? Means :source-paths
from different profiles get merged? This does not seem to be the case - right? Apart from a certain setting that addresses "env/dev/src" and "env/prod/src" (and test) which works, this does not seem to be a working mechanism. This is a pity. My new project has a setting with PostgreSQL and another build targets H2. So I have two scaffolding code sections which cannot be splitted during runtime. Hence, I came up with this idea in my project.cls
:
:source-paths ["src/clj" "src/cljs" "src/cljc"]
:aliases {"remote" ["with-profile" "dev/postgresql" "do"
["clean"]
["run" "-m" "storyarcher.core"]]
"embedded" ["with-profile" "dev/h2" "do"
["clean"]
["run" "-m" "storyarcher.core"]]}
:profiles {:dev [:project/dev :profiles/dev :db/postgresql]
:dev/postgresql [:project/dev :profiles/dev :db/postgresql]
:dev/h2 [:project/dev :profiles/dev :db/h2]
:test [:project/dev :project/test :profiles/test]
:project/dev {:jvm-opts ["-Dconf=dev-config.edn"]
...usual stuff...
:source-paths ["env/dev/clj" "env/dev/cljs" "test/cljs"]}
:db/postgresql {:source-paths ["srcadds/clj/db/postgresql" "env/dev/clj" "env/dev/cljs" "test/cljs"]}
:db/h2 {:source-paths ["srcadds/clj/db/h2" "env/dev/clj" "env/dev/cljs" "test/cljs"]}
But I get
$ lein remote
Exception in thread "main" Syntax error macroexpanding clojure.core/ns at (storyarcher/db/adds.clj:1:1).
...Ton of thread stack... then:
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec. {:clojure.spec.alpha/problems
... Tons of specs... not important, I think, then:
Error encountered performing task 'do' with profile(s): 'dev,dev,postgresql'
Suppressed exit
and my IDE (VS Code Calva) tells me, that these particular files in srcadds have this problem in line 1 (defining namespace), quote:
> Can't parse /home/ak/data/private-projects/StoryArcher/tmp/thisisit/storyarcher/srcadds/clj/db/postgresql/storyarcher/db/adds.clj, Unparsable namespace formclj-kondo(syntax)
So defining different :source-paths
in different :profiles
and then combining them and addressing them via :aliases
call is not a feasable thing in Leiningen. Is that correct?
Thanks for hints and your time!I forgot, the file srcadds/clj/db/postgresql/storyarcher/db/adds.clj
starts with (line 1):
(ns storyarcher.db.adds
(:require [[cheshire.core :refer [generate-string parse-string]]
which looks pretty normal to me.>
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec.
(:require [[cheshire.core :refer [generate-string parse-string]]
isn’t valid.Hrmm... I see an "extra" [] around the stuff in :require. Could that be the culprit? Here is the total line:
(ns storyarcher.db.adds
(:require [[cheshire.core :refer [generate-string parse-string]]
[next.jdbc.date-time]
[next.jdbc.prepare]
[next.jdbc.result-set]])
(:import (org.postgresql.util PGobject)))
you are getting a type error. It said “invalid ns form”. You just skipped over what the type error was telling you
True. Yet I was looking over that line one bazillion times, and the IDE failed to point me idiot to the right spot. But thanks, I really appreciate it!
and if i eval that in my repl it highlights the part it cannot parse:
Syntax error macroexpanding clojure.core/ns at (REPL:85:1).
((:require [[cheshire.core :as json] [clojure.test :refer :all] [metabase.api.geojson :as api.geojson] [metabase.http-client :as client] [metabase.models.setting :as setting] [metabase.test :as mt] [metabase.util :as u] [metabase.util.schema :as su] [schema.core :as s]])) - failed: Extra input spec: :clojure.core.specs.alpha/ns-form