Fork me on GitHub
#leiningen
<
2022-06-14
>
Marius07:06:53

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

Marius07:06:13

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

Marius08:06:48

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

mikerod17:06:49

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

mikerod17:06:02

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

mikerod17:06:45

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

vemv17:06:22

> 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

mikerod17:06:31

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

mikerod17:06:39

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.

mikerod17:06:48

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

👍 1
Marius18:06:09

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.

Marius19:06:47

Thank you, I’ll give it a try

Marius19:06:44

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