lein在mac上安装datomic peer library

时间:2014-10-28 22:08:44

标签: clojure leiningen gnupg datomic

我无法让leiningen下载datomic-pro peer库。我有以下设置:

~/.lein/credentials.clj.gpg

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

项目

(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"]])

我通过brew install gpg安装gpg,然后运行lein deps会出现以下错误:

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.

注意:我创建了一个pom.xml / settings.xml,如主页上所述,并立即与maven一起使用。我也知道我可以直接从datomic/bin/maven-install安装对等库,但我更喜欢普通的leiningen安装。

2 个答案:

答案 0 :(得分:11)

我也有很多问题。根据您运行的操作系统,它会有所不同。对我有用的一件事是使用env vars而不是gpg路线。

将此添加到您的环境变量(.bashrc文件是unixy操作系统上最简单的)

export MY_DATOMIC_USERNAME="your@email.com"
export MY_DATOMIC_PASSWORD="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

重新加载bash并检查它们是否存在:

$  echo $MY_DATOMIC_USERNAME
your@email.com

然后将其添加到您的project.clj文件中:

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

当然,添加您想要的依赖项版本,例如:

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

lein deps后你应该加载你需要的库。

希望这有帮助。

答案 1 :(得分:4)

我发现了这个:https://github.com/technomancy/leiningen/blob/master/doc/DEPLOY.md#gpg

使用您的凭据创建~/.lein/credentials.clj文件的位置:

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

然后用gpg加密它:

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

为我工作,我希望有所帮助