2014-10-28 37 views
7

我无法让leiningen下载datomic-pro对等库。我有以下设置:lein在mac上安装datomic 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安装。

回答

11

我也有一堆的问题。取决于您在其上运行的操作系统有所不同。有一件事情对我来说是使用env vars而不是gpg路线。

添加到您的环境瓦尔(.bashrc文件是最简单的unixy OSS)

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

刷新bash和检查它们的存在:

$ echo $MY_DATOMIC_USERNAME 
[email protected] 

然后添加到您的project.clj file:

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

然后添加你想要的任何版本到你的dep例如:

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

经过lein deps之后,您应该已经加载了您需要的库。

希望这会有所帮助。

+1

试过这个,我仍然得到这个:“不能传递工件com.datomic:datomic-pro:pom:0.9.5206 from/to my.datomic.com(https://my.datomic.com/repo):未经授权,ReasonPhrase:未经授权。 这可能是由于以下方面的错误:依赖性或网络问题。 如果你在代理的后面,试着设置'http_proxy'的环境变量。“ – letronje 2015-09-03 04:00:44

+0

@letronje你有没有想过呢?我得到的东西在流浪汉上运行的一样 – Kendall 2016-07-07 15:35:11

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 

为我工作,我希望它有助于

+1

我不得不运行'gpg --gen-key'在这之前对我来说(在'brew install gpg'之后) – Adam 2015-03-11 01:16:07