lein install datomic peer library on mac
Asked Answered
C

2

8

I cannot get leiningen to download the datomic-pro peer library. I have the following setup:

~/.lein/credentials.clj.gpg

{#"my\.datomic\.com" {:username "..."
                      :password "..."}}

And the project

(defproject datomic-example "0.1.0-SNAPSHOT"

  :repositories {"my.datomic.com" {:url "https://my.datomic.com/repo"
                                   :creds :gpg}}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [com.datomic/datomic-pro "0.9.4956"]])

I install gpg via brew install gpg, then running lein deps gives me the following error:

Could not decrypt credentials from /Users/.../.lein/credentials.clj.gpg
gpg: no valid OpenPGP data found.
gpg: decrypt_message failed: eof

See `lein help gpg` for how to install gpg.
(Could not transfer artifact com.datomic:datomic-pro:pom:0.9.4956 from/to my.datomic.com (https://my.datomic.com/repo): Not authorized , ReasonPhrase:Unauthorized.)
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.

NOTE: I created a pom.xml / settings.xml as described on the homepage and that worked immediatly with maven. I also know that I can install the peer library directly from datomic/bin/maven-install, but I would prefer a plain leiningen install.

Criollo answered 28/10, 2014 at 22:8 Comment(0)
P
12

I had a bunch of problems with that too. Depending on what OS you're running on it varies. One thing that worked for me was using env vars rather than the gpg route.

Add this to your environment vars (.bashrc file is the easiest on unixy OSs)

export MY_DATOMIC_USERNAME="[email protected]"
export MY_DATOMIC_PASSWORD="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Reload bash and check that they are there:

$  echo $MY_DATOMIC_USERNAME
[email protected]

Then add this to your project.clj file:

:repositories [["my.datomic.com" {:url "https://my.datomic.com/repo"
                        :username [:env/my_datomic_username]
                        :password [:env/my_datomic_password]}]]

And of course add whichever version you want to your dependencies eg:

[com.datomic/datomic-pro "0.9.4815.12"]

After a lein deps you should have loaded the libs you need.

Hope this helps.

Preterhuman answered 31/10, 2014 at 0:34 Comment(2)
Tried this and I am still getting this: "Could not transfer artifact com.datomic:datomic-pro:pom:0.9.5206 from/to my.datomic.com (my.datomic.com/repo): Not authorized , ReasonPhrase:Unauthorized. 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."Elsey
@Elsey did you ever figure it out? I get the same thing running on a vagrantSparteine
R
4

I found this: https://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md#gpg

Where you create a ~/.lein/credentials.clj file with your credentials:

{#"my\.datomic\.com" {:username "USERNAME"
                      :password "PASSWORD"}}

And then encrypt it with gpg:

$ gpg --default-recipient-self -e ~/.lein/credentials.clj > ~/.lein/credentials.clj.gpg

Worked for me, I hope it helps

Rogerson answered 30/12, 2014 at 22:39 Comment(1)
I had to run gpg --gen-key before this would work for me (after brew install gpg)Lodging

© 2022 - 2024 — McMap. All rights reserved.