leiningen

2023-07-11T18:34:58.800989Z

I've noticed that test/user.clj is being evaluated when running lein with-profile production uberjar . Is there any way to prevent that?

2023-07-11T18:37:06.678549Z

I'm running lein 2.10.0. You should be able to reproduce this by creating a demo app with lein new app and creating test/user.clj with the following contents:

(ns user)

(println "Running test/user.clj")
and then lein uberjar to see the message print

vemv 2023-07-11T18:37:50.790479Z

Try: lein with-profile -user,-dev,-test production uberjar and make sure "test" is not in your :source-paths, :test-paths, :resource-paths within the :production profile

2023-07-11T18:41:10.119179Z

$ lein with-profile -user,-dev,-test production uberjar
'production' is not a task. See 'lein help'.
Error encountered performing task 'production' with profile(s): 'base,system,provided'
Task not found
Maybe you meant
$ lein with-profile -user,-dev,-test,+production uberjar
Running test/user.clj
Compiling inthejar.core
Created /home/laverne/repos/inthejar/target/uberjar+production/inthejar-0.1.0-SNAPSHOT.jar
Created /home/laverne/repos/inthejar/target/uberjar/inthejar-0.1.0-SNAPSHOT-standalone.jar
which as you can see still prints

2023-07-11T18:41:34.431979Z

I don't have a production profile in project.clj or in ~/.lein/profiles.clj

vemv 2023-07-11T18:43:42.317779Z

Yes I meant that are you sure "test" isn't anywhere unusual within project.clj?

vemv 2023-07-11T18:44:06.403259Z

Another possibility being some plugin going on

2023-07-11T18:44:32.272369Z

yeah, I should check my plugins...

2023-07-11T18:46:44.248539Z

I've commented out everything in ~/.lein/profiles.clj my project.clj is just:

(defproject inthejar "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.1"]]

  :src-paths ["src"]
  :main ^:skip-aot inthejar.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})

vemv 2023-07-11T18:47:42.492899Z

should be :source-paths :)

2023-07-11T18:49:52.031379Z

ha! I added that as a debugging step and was wondering why dumping additional entries in there seemed to have no effect. Anyway, removing that nonsense line didn't change the output

vemv 2023-07-11T18:51:40.356519Z

perhaps :source-paths ["src"] can help, I've had related experiences also, for that project, lein with-profile -user,-dev,-test,+uberjar uberjar would be the nicest invocation other than that I ran out of ideas 😑

vemv 2023-07-11T18:54:17.180029Z

Perhaps you AOTed at some point? Try lein clean / git clean -fdx

2023-07-11T18:55:09.781399Z

no dice. I'll open a bug report. Thanks for your help!

🍻 1