leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
antono 2019-12-06T14:11:06.185600Z

Hey, I am having a problem with lein When I run lein test it works normally, but when I run lein with-profile ci-tests, I get the error

Syntax error (IllegalAccessError) compiling at (clojure/tools/reader/edn.clj:1:1).
reader-error does not exist
This is the profile config:
:test {:resource-paths ["test/resources"]
                    :dependencies [[clj-http "3.10.0"]]} 
             :ci-tests {:test-paths ["ci-tests/resources"]
                    :dependencies [[clj-http "3.10.0"]]}

2019-12-06T14:21:20.186200Z

@aoellerer do you have any other profiles?

antono 2019-12-06T14:21:37.186500Z

:dev {:resource-paths ["dev/resources"]
                    :source-paths ["dev"]
                    :dependencies [[org.clojure/tools.namespace "0.3.1"]
                                   [clj-http "3.10.0"]]}}

2019-12-06T14:22:56.188100Z

Ok. So try lein with-profile +ci-tests ie added a +

2019-12-06T14:25:19.190800Z

Also I’m pretty sure the :test profile is always going to be active during the test task. So if you need stuff to not be included during ci-tests then they should go to a non-special profile.

antono 2019-12-06T14:28:40.191500Z

What do you mean? That I can take the clj-http dependency out of the dependecies?

antono 2019-12-06T14:56:30.192Z

Ok, I now get a similar error when running lein uberjar

antono 2019-12-06T15:03:20.192500Z

It seems as if you have to include [org.clojure/tools.reader "1.3.2"] into the dependencies

2019-12-06T15:23:10.193Z

@aoellerer you are transitively getting that dependency (`org.clojure/tools.reader`) from org.clojure/tools.namespace most likely

2019-12-06T15:23:30.193500Z

if you have an explicit dependency on it, it’s correct for you to declare it directly instead of rely on org.clojure/tools.namespace to bring it for you

2019-12-06T15:24:03.194200Z

lein ubejar will not include default lein profiles - intentionally it leaves out all profiles not specified except the “special” profile name uberjar

2019-12-06T15:24:24.194700Z

this is because the default profiles have things that shouldn’t be in your “production deployed artifacts”

2019-12-06T15:24:58.195200Z

and when you use with-profile you take explicit control of what profiles are added - so again, the default lein profiles do not get added

2019-12-06T15:25:42.196100Z

if you use with-profile +my-profile that means to include my-profile plus any other default profiles already active

2019-12-06T15:26:07.196600Z

which worked in your ci-tests case, since presumably you were running the test task

2019-12-06T15:27:01.197400Z

lein uberjar and lein jar (which also affects lein install )are a bit more aggressive though - they will remove default profiles and you have to instead use :leaky metadata - but won’t get into that - not typically needed

antono 2019-12-06T15:30:43.198100Z

Thank you!

👍 1
2019-12-06T16:48:59.198500Z

no problem, hopefully it starts to make sense for you w/this