4
votes

I am trying to use the s3-wagon-private plugin. I have two lein projects:

  • X: a library I made for doing some data munging. Has some 3rd party dependencies.
  • Y: a library I made for working with my database, has X and some 3rd party dependencies.

I have the following in my ~/.lein/profiles.clj file:

{:repl {:dependencies [[org.clojure/tools.nrepl "0.2.12"]]}
 :user {:plugins [[cider/cider-nrepl "0.10.0"]
              [s3-wagon-private "1.2.0"]]
 :signing {:gpg-key "0xabcdef12"}
 :repositories [["private" {:url "s3p://acme/releases/"
                            :username :env
                            :passphrase :env}]]}}

When I run lein deploy private in project X, everything work just fine and it gets deployed to S3.

When I run lein deploy private in project Y, it complains about not being able to find project X.

Could not find artifact X:X:jar:0.7.0 in central (https://repo1.maven.org/maven2/)
Could not find artifact X:X:jar:0.7.0 in clojars (https://clojars.org/repo/)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.

In other words, it is not looking in my private S3 repo to try to find project X. How do I solve this?


UPDATE: 2016-04-25

In a comment, Daniel Compton asked:

What happens when you run lein deps in project Y? From your error message, it looks like the repository "private" isn't present in project Y.

When I run lein deps in project Y, it does NOT give any errors:

(py3)aj-laptop:red aj$ lein deps
(:repositories detected in user-level profiles! [:user] 
See https://github.com/technomancy/leiningen/wiki/Repeatability)

So I added the following to project.clj in project Y. This made lein deploy private work as expected:

:repositories [["private" {:url "s3p://acme/releases/"
                           :username :env
                           :passphrase :env}]]

So it seems that Project Y is not picking up :repositories from my ~/.lein/profiles.clj file. But Project X seems to pick it up just fine.

1
Lest anyone should think that I didn't do my due diligence on this, I spent several hours on this last night reading through documentation, the master projects.clj file on github, etc. and trying out a number of variations. No dice. - Aaron Johnson
What happens when you run lein deps in project Y? From your error message, it looks like the repository "private" isn't present in project Y. - Daniel Compton

1 Answers

1
votes

The issue is that the :repositories were specified in the user ~/.lein/profiles.clj file. Leiningen doesn't really like this. I suspect there is a latent bug here, perhaps in the interactions between Lein plugins and the dependency resolution system. Because it is generally not recommended to put :repositories in your user profile people may not have run into this before.

I think the best solution is probably to add :repositories to every file, annoying though that may be.