Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lein install datomic peer library on mac

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.

like image 394
shaft Avatar asked Oct 28 '14 22:10

shaft


2 Answers

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.

like image 139
adamneilson Avatar answered Nov 12 '22 02:11

adamneilson


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

like image 27
Konrad Avatar answered Nov 12 '22 02:11

Konrad