lein-exec icon indicating copy to clipboard operation
lein-exec copied to clipboard

Add support for settings from user profiles.clj

Open sashton opened this issue 9 years ago • 0 comments

It appears that the user profile -- ~/.lein/profiles.clj -- is not used for setting repositories/local-repo/mirrors when executing scripts. If I have a custom local repo set in profiles, and I lein install a custom library, I am unable to refer to it in a script, since it can't be found in the default repositories.

Also, at work I have to specify mirrors for repositories. I've already done that in ~/.lein/profiles.clj, and it would be un-DRY if I had to specify the correct repos in every script, rather than a single profiles.clj file.

If I have a non-default local-repo setting in my profiles.clj, and I somehow configure my script to refer to it (not sure if that's even possible), I can't share my script with a team member who has a different local-repo location.

Example:

~/.lein/profiles.clj
{:user {:local-repo "/custom/location/.m2/"
        :plugins [[lein-exec "0.3.4"]]
        :mirrors {"central" {:name "central"
                             :url "http://my.corp/central"}}
Then running:
$ cd ~
$ lein new app cool-library
$ lein install
Installed jar and pom into /custom/location/.m2/.
~/some-script.clj
(use '[leiningen.exec :only (deps)])
(deps '[[cool-library "0.1.0-SNAPSHOT"]])
Trying to use the dependency
$ cd ~
$ lein exec example.clj
clojure.lang.Compiler$CompilerException: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact cool-library:cool-library:jar:0.1.0-SNAPSHOT in clojars (http://clojars.org/repo), compiling:(~/example.clj:3:37)


sashton avatar Apr 30 '15 00:04 sashton