##0、确保‘clojars.org’可访问(关键)。
- 注1:安装lein,不在本文范围
- 注2:安装gpg,不在本文范围。请移步:http://www.ruanyifeng.com/blog/2013/07/gpg.html
- 注3:gpg下载链接http://gpg4win.org/download.html,我找的最小的下 gpg4win-vanilla。
- 注4:带括号的步骤为验证性质,可忽略。
##1 $ lein new just-for-fun
##2 project.clj (defproject misty000/just-for-fun "0.0.1"
##(3)$ lein deploy clojars (尝试发布,提示没有gpg秘钥,先安装gpg) WARNING: please set :url in project.clj. No credentials found for clojars (did you mean lein deploy clojars
?) See lein help deploy
for how to configure credentials. Username: yours@sohu.com Password: Wrote /home/yours/文档/Devel/just-for-fun/pom.xml Created /home/yours/文档/Devel/just-for-fun/target/just-for-fun-0.0.1.jar Could not sign /home/yours/文档/Devel/just-for-fun/target/just-for-fun-0.0.1.jar gpg: 已创建目录‘/home/yours/.gnupg’ gpg: 新的配置文件‘/home/yours/.gnupg/gpg.conf’已建立 gpg: 警告:在‘/home/yours/.gnupg/gpg.conf’里的选项于此次运行期间未被使用 gpg: 钥匙环‘/home/yours/.gnupg/secring.gpg’已建立 gpg: 钥匙环‘/home/yours/.gnupg/pubring.gpg’已建立 gpg: no default secret key: 没有秘匙 gpg: signing failed: 没有秘匙
See `lein help gpg` for how to set up gpg.
If you don't expect people to need to verify the authorship of your jar, you
can add `:sign-releases false` to the relevant `:deploy-repositories` entry.
##4、$ gpg --gen-key (gen-key前面是两个-
,选项全部默认即可,问你是否确定的地方输入y,弹出小窗口输两次私钥密码) gpg (GnuPG) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
请选择您要使用的密钥种类:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (仅用于签名)
(4) RSA (仅用于签名)
您的选择?
RSA 密钥长度应在 1024 位与 4096 位之间。
您想要用多大的密钥尺寸?(2048)
您所要求的密钥尺寸是 2048 位
请设定这把密钥的有效期限。
0 = 密钥永不过期
<n> = 密钥在 n 天后过期
<n>w = 密钥在 n 周后过期
<n>m = 密钥在 n 月后过期
<n>y = 密钥在 n 年后过期
密钥的有效期限是?(0) 2y
密钥于 2015年12月25日 星期五 15时36分03秒 CST 过期
以上正确吗?(y/n)y
You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
真实姓名:Your Name
电子邮件地址:yours@sohu.com
注释:
您选定了这个用户标识:
“Your Name <yours@sohu.com>”
更改姓名(N)、注释(C)、电子邮件地址(E)或确定(O)/退出(Q)?o
您需要一个密码来保护您的私钥。
我们需要生成大量的随机字节。这个时候您可以多做些琐事(像是敲打键盘、移动
鼠标、读写硬盘之类的),这会让随机数字发生器有更好的机会获得足够的熵数。
gpg: /home/yours/.gnupg/trustdb.gpg:建立了信任度数据库
gpg: 密钥 02FB1157 被标记为绝对信任
公钥和私钥已经生成并经签名。
gpg: 正在检查信任度数据库
gpg: 需要 3 份勉强信任和 1 份完全信任,PGP 信任模型
gpg: 深度:0 有效性: 1 已签名: 0 信任度:0-,0q,0n,0m,0f,1u
gpg: 下次信任度数据库检查将于 2015-12-25 进行
pub 2048R/02FB1157 2013-12-25 [有效至:2015-12-25]
密钥指纹 = 1F1B BCDA 54A5 AD0B 6302 BF17 5AF3 E2CE 02FB 1157
uid Your Name <yours@sohu.com>
sub 2048R/D5F2E5EC 2013-12-25 [有效至:2015-12-25]
##5、$ lein deploy clojars WARNING: please set :url in project.clj. No credentials found for clojars (did you mean lein deploy clojars
?) See lein help deploy
for how to configure credentials. Username: yours@sohu.com ;;; 'clojars.org'的登录名/密码 Password: Wrote /home/yours/文档/Devel/just-for-fun/pom.xml Created /home/yours/文档/Devel/just-for-fun/target/just-for-fun-0.0.1.jar
您需要输入密码,才能解开这个用户的私钥:“Your Name <yours@sohu.com>”
2048 位的 RSA 密钥,钥匙号 02FB1157,建立于 2013-12-25
;;; 弹出窗口中输入之前设置的私钥密码
您需要输入密码,才能解开这个用户的私钥:“Your Name <yours@sohu.com>”
2048 位的 RSA 密钥,钥匙号 02FB1157,建立于 2013-12-25
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom (3k)
to https://clojars.org/repo/
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar (7k)
to https://clojars.org/repo/
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar.asc (1k)
to https://clojars.org/repo/
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom.asc (1k)
to https://clojars.org/repo/
Could not find metadata misty000:just-for-fun/maven-metadata.xml in clojars (https://clojars.org/repo/)
Sending misty000/just-for-fun/maven-metadata.xml (1k)
to https://clojars.org/repo/
注1:Clojars的Profile中未设置‘SSH public key’和‘PGP public key’,但发布成功。 注2:项目页面中有一些提示信息: promotion Missing scm Could not verify signature of /home/clojars/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar. Ensure your public key is in your profile. Could not verify signature of /home/clojars/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom. Ensure your public key is in your profile. (无法核实签名。确保profile中已经设置了public key。(应该指的是‘PGP public key’))
##(6)、$ lein new just-for-fun-test (创建测试项目) project.clj add [misty000/just-for-fun "0.0.1"] to :dependencies $ cd just-for-fun-test/ $ lein deps Retrieving misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom from clojars Retrieving misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar from clojars
##7、$ gpg --list-keys /home/yours/.gnupg/pubring.gpg ------------------------------ pub 2048R/02FB1157 2013-12-25 [有效至:2015-12-25] uid Your Name yours@sohu.com sub 2048R/D5F2E5EC 2013-12-25 [有效至:2015-12-25]
$ gpg --export -a 02FB1157
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)
mQENBFK6i0IBCADDLwsypKz6nhn8dJsSoRBuxR7yRaGOpyPZBicvNuSsN9q3AqWg
whrrLC7utSR8X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G+Qpse5E4gQG8hiZ8YSFU7i0We4owpJwARAQABiQElBBgBAgAPBQJSuotCAhsM
BQkDwmcAAAoJEFrz4s4C+xFXI5sH/i6gL3kyQdibxHGBTzEWalXLPbd8ErobTr3t
31FoHdBp3zo3s/QXQ8FmxC5b9Ib0rg33wxkWUL1HA4hQ6mqCpQlkCQCdVSB69HJJ
piOCktha0/WSMW5Z9Xw9B2MTk9VhqE5Mx25xhyB5+kts9bC7mTs3bPrGcx7ucjUr
JHrTD5vP3kTDLh3uQ7Js4iUMWBLzP6sO7mDnpTZKxwu1/q5p7OcWwg/2qDyNe+Fq
N7+aXHTQBUqHq2BBeFHZ/2r7uP0wfEacFiqEeie7zgbGRmpnuTnvdutBfM8dUgLo
dViUGfisVRvdOsg0XYpMUHahu2xCHLLz5wfWj/NQL+q9n+Y/ukI=
=RMB2
-----END PGP PUBLIC KEY BLOCK-----
注1:这里要用公钥,即:02FB1157 注2:将生成的‘PGP PUBLIC KEY’粘贴到‘https://clojars.org/profile’的‘PGP public key:’文本框,包括‘-----BEGIN PGP PUBLIC KEY BLOCK-----’和‘-----END PGP PUBLIC KEY BLOCK-----’ 注3:步骤5注2中的签名警告已经消除,‘Missing scm’不知道如何消除。
##(8)、$ lein deploy clojars (尝试重新发布,发布失败,应该是版本号重复的原因) WARNING: please set :url in project.clj. No credentials found for clojars (did you mean lein deploy clojars
?) See lein help deploy
for how to configure credentials. Username: yours@sohu.com Password: Wrote /home/yours/文档/Devel/just-for-fun/pom.xml Created /home/yours/文档/Devel/just-for-fun/target/just-for-fun-0.0.1.jar
您需要输入密码,才能解开这个用户的私钥:“Your Name <yours@sohu.com>”
2048 位的 RSA 密钥,钥匙号 02FB1157,建立于 2013-12-25
您需要输入密码,才能解开这个用户的私钥:“Your Name <yours@sohu.com>”
2048 位的 RSA 密钥,钥匙号 02FB1157,建立于 2013-12-25
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom (3k)
to https://clojars.org/repo/
Could not transfer artifact misty000:just-for-fun:pom:0.0.1 from/to clojars (https://clojars.org/repo/): Access denied to: https://clojars.org/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom, ReasonPhrase: Forbidden.
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar (7k)
to https://clojars.org/repo/
Could not transfer artifact misty000:just-for-fun:jar:0.0.1 from/to clojars (https://clojars.org/repo/): Access denied to: https://clojars.org/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar, ReasonPhrase: Forbidden.
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar.asc (1k)
to https://clojars.org/repo/
Could not transfer artifact misty000:just-for-fun:jar.asc:0.0.1 from/to clojars (https://clojars.org/repo/): Access denied to: https://clojars.org/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.jar.asc, ReasonPhrase: Forbidden.
Sending misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom.asc (1k)
to https://clojars.org/repo/
Could not transfer artifact misty000:just-for-fun:pom.asc:0.0.1 from/to clojars (https://clojars.org/repo/): Access denied to: https://clojars.org/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom.asc, ReasonPhrase: Forbidden.
Failed to deploy artifacts: Could not transfer artifact misty000:just-for-fun:pom:0.0.1 from/to clojars (https://clojars.org/repo/): Access denied to: https://clojars.org/repo/misty000/just-for-fun/0.0.1/just-for-fun-0.0.1.pom, ReasonPhrase: Forbidden.
注:已经发布过的版本重新发布会被拒绝。
##(9)、just-for-jun项目project.clj (提升版本号后重新发布) (defproject misty000/just-for-fun "0.0.2"
$ lein deploy clojars
WARNING: please set :url in project.clj.
No credentials found for clojars (did you mean `lein deploy clojars`?)
See `lein help deploy` for how to configure credentials.
Username: yours@sohu.com
Password:
Wrote /home/yours/文档/Devel/just-for-fun/pom.xml
Created /home/yours/文档/Devel/just-for-fun/target/just-for-fun-0.0.2.jar
您需要输入密码,才能解开这个用户的私钥:“Your Name <yours@sohu.com>”
2048 位的 RSA 密钥,钥匙号 02FB1157,建立于 2013-12-25
您需要输入密码,才能解开这个用户的私钥:“Your Name <yours@sohu.com>”
2048 位的 RSA 密钥,钥匙号 02FB1157,建立于 2013-12-25
Sending misty000/just-for-fun/0.0.2/just-for-fun-0.0.2.pom (3k)
to https://clojars.org/repo/
Sending misty000/just-for-fun/0.0.2/just-for-fun-0.0.2.jar (7k)
to https://clojars.org/repo/
Sending misty000/just-for-fun/0.0.2/just-for-fun-0.0.2.jar.asc (1k)
to https://clojars.org/repo/
Sending misty000/just-for-fun/0.0.2/just-for-fun-0.0.2.pom.asc (1k)
to https://clojars.org/repo/
Retrieving misty000/just-for-fun/maven-metadata.xml (1k)
from https://clojars.org/repo/
Sending misty000/just-for-fun/maven-metadata.xml (1k)
to https://clojars.org/repo/
注:提升版本号后发布成功。
##10、‘https://clojars.org/profile’中的‘SSH public key’不知道有什么用。