leiningen

Marius 2022-06-14T07:52:53.223329Z

Thanks, I tried that, but it seems not to have any effect. I’ll add my project.clj here, thank you!

Marius 2022-06-14T07:53:13.296389Z

(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 {}})

Marius 2022-06-14T08:04:48.011819Z

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

2022-06-14T17:07:49.897829Z

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

2022-06-14T17:08:02.139539Z

Default behaviors typically work. So I'm a bit confused there.

2022-06-14T17:08:45.700469Z

It also depends what lein task you are calling whether or not the dev profile is enabled

vemv 2022-06-14T17:10:22.382789Z

> 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

2022-06-14T17:11:31.137609Z

I mean the javac typically doesn't need special profile handling as a prep-tasks

2022-06-14T17:12:39.637639Z

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.

2022-06-14T17:13:48.791719Z

I do agree I think lein can be too mysterious regarding which profiles may be enabled at which times with built in tasks.

👍 1
Marius 2022-06-14T18:38:09.457449Z

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.

Marius 2022-06-14T19:08:47.321939Z

Thank you, I’ll give it a try

Marius 2022-06-14T19:09:44.567899Z

Although I assumed that interleaving is not necessary since my Java code does not reference any Clojure code