This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-14
Channels
- # announcements (2)
- # babashka (27)
- # beginners (20)
- # biff (1)
- # cljs-dev (2)
- # clojars (19)
- # clojure (50)
- # clojure-austin (10)
- # clojure-australia (8)
- # clojure-europe (23)
- # clojure-losangeles (1)
- # clojure-nl (1)
- # clojure-spec (7)
- # clojured (7)
- # clojurescript (19)
- # cursive (4)
- # datalevin (9)
- # datomic (15)
- # emacs (7)
- # fulcro (25)
- # gratitude (2)
- # helix (1)
- # holy-lambda (2)
- # hyperfiddle (14)
- # introduce-yourself (1)
- # jobs (5)
- # joyride (2)
- # juxt (3)
- # kaocha (9)
- # leiningen (14)
- # meander (9)
- # minecraft (34)
- # nbb (18)
- # off-topic (15)
- # polylith (12)
- # re-frame (4)
- # remote-jobs (1)
- # shadow-cljs (79)
- # vim (57)
Thanks, I tried that, but it seems not to have any effect. I’ll add my project.clj here, thank you!
(defproject test “0.1.0-SNAPSHOT” :description “Test” :url “https://test.com” :dependencies [...] :min-lein-version “2.0.0" :source-paths [“src/clj” “src/cljs” “src/cljc”] :java-source-paths [“src/java” “test/java”] :test-paths [“test/clj”] :junit [“test/java”] :junit-formatter :plain :junit-results-dir “test-results” :resource-paths [“resources” “target/cljsbuild”] :target-path “target/%s/” :main ^:skip-aot test.core :plugins [[migratus-lein “0.7.3"] [com.github.liquidz/antq “1.5.0”] [lein-junit “1.1.9"]] :migratus {:store :database :migration-dir “resources/migrations” :db ~(get (System/getenv) “DATABASE_URL”)} :clean-targets ^{:protect false} [:target-path “target/cljsbuild” “.shadow-cljs”] :profiles {:uberjar {:omit-source true :prep-tasks [“javac” “compile” [“run” “-m” “shadow.cljs.devtools.cli” “release” “app”]] :aot :all :uberjar-name “test.jar” :source-paths [“env/prod/clj” “env/prod/cljc” “env/prod/cljs”] :resource-paths [“env/prod/resources”]} :dev [:project/dev :profiles/dev] :test [:project/dev :project/test :profiles/test] :project/dev {:jvm-opts [“-Dconf=dev-config.edn”] :dependencies [[binaryage/devtools “1.0.4"] [cider/piggieback “0.5.3”] [org.clojure/tools.namespace “1.1.1"] [pjstadig/humane-test-output “0.11.0”] [prone “2021-04-23"] [re-frisk “1.5.2”] [ring/ring-devel “1.9.4"] [ring/ring-mock “0.4.0”] [junit “4.8.1"]] :plugins [[com.jakemccrary/lein-test-refresh “0.24.1”] [jonase/eastwood “0.3.5"] [cider/cider-nrepl “0.26.0”]] :source-paths [“env/dev/clj” “env/dev/cljc” “env/dev/cljs” “test/cljs”] :resource-paths [“env/dev/resources”] :repl-options {:init-ns user :timeout 120000} :injections [(require ’pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)]} :project/test {:jvm-opts [“-Dconf=test-config.edn”] :resource-paths [“env/test/resources”]} :profiles/dev {} :profiles/test {}})
I found the solution here: https://stackoverflow.com/questions/40824115/lein-javac-tries-to-compile-clojure-code-and-fails The :dev profile is enabled by default. It works when compiling the Java source without :dev profile:
lein with-profile -dev javac
I don't really understand why you'd have to do anything special like remove the profile of you had your java-source-paths separate from your clj
It also depends what lein task you are calling whether or not the dev profile is enabled
> Default behaviors typically work. Not sure if I agree with that statement, the implicit dev profile often causes all sorts of issues Sadly many Lein users have complected their notions of 'dev' and 'test'. There's something to be learned from deps.edn here
And dev-time tasks tend to include the lein default profiles which includes dev. Deployable artifact ones typically do not do this. Like install, jar, uberjar. So I'm guessing the issue was with some dev time tasks having a problem due to something in the dev profile causing issues.
I do agree I think lein can be too mysterious regarding which profiles may be enabled at which times with built in tasks.
I’m afraid I have to stand corrected.
With lein with-profile -dev javac
the exception is gone - but the .class files are not compiled. So nothing is gained. Sorry for not figuring this out earlier, I forgot to run lein clean
beforehand. Back to square one.
@mail990 perhaps this technique is of use? https://github.com/technomancy/leiningen/blob/2.9.8/doc/MIXED_PROJECTS.md#interleaving-compilation-steps