clojure中检查依赖的包是否有更新

来源:互联网 发布:软考程序员教程 编辑:程序博客网 时间:2024/05/20 03:46

每次都去网上查看每个依赖的包是否有更新是一件很麻烦的琐事。尤其是有很多依赖的时候。对于clojure,可以使用lein-ancient进行管理。

检查

在项目中加入该插件后,只要执行lein ancient就可以对依赖项进行检查。非常方便。

$ lein ancient[org.clojure/clojurescript "0.0-2371"] is available but we use "0.0-2356"[compojure "1.2.1"] is available but we use "1.2.0"[com.cognitect/transit-cljs "0.8.192"] is available but we use "0.8.188"

此外lein-ancient也提供了一些查看过滤选项::allow-snapshots,:allow-qualified, :allow-all, :plugins, :all, :recursive

如果要对~/.lein/profiles.clj进行更新,则执行lein ancient profiles [<options>]

升级

仅仅只检查是不够滴,还可以通过该插件对依赖项进行升级

$lein ancient upgrade :interactive[org.clojure/clojurescript "0.0-2371"] is available but we use "0.0-2356"Do you want to upgrade? [yes/no] yes[compojure "1.2.1"] is available but we use "1.2.0"Do you want to upgrade? [yes/no] yes[com.cognitect/transit-cljs "0.8.192"] is available but we use "0.8.188"Do you want to upgrade? [yes/no] yes3 artifacts were upgraded.

另外,lein-ancient也支持回归测试。如果升级完的测试失败,会自动回滚到升级前的版本。也可以用它来查看指定组件的版本信息:

$ lein ancient get com.taoensso/timbre :allow-allGetting Version Information for com.taoensso/timbre from 3 Repositories ...  * 64 version(s) found.  * latest release:          "3.3.1"  * latest SNAPSHOT:         "3.3.0-SNAPSHOT"  * latest qualified:        "3.3.1-1cd4b70"  * all releases:            [ "3.3.1" "3.3.0" "3.2.1" "3.2.0" "3.1.6"                                "3.1.5" "3.1.4" "3.1.3" "3.1.2" "3.1.1"                                "3.1.0" "3.0.1" "3.0.0" "2.7.1" "2.7.0"                                "2.6.3" "2.6.2" "2.6.1" "2.6.0" "2.5.0"                                "2.4.1" "2.4.0" "2.3.4" "2.3.3" "2.3.2"                                "2.3.1" "2.3.0" "2.2.0" "2.1.2" "2.1.1"                                "2.0.1" "2.0.0" "1.6.0" "1.5.3" "1.5.2"                                "1.5.1" "1.5.0" "1.4.0" "1.3.1" "1.3.0"                                "1.2.0" "1.1.0" "1.0.0" "0.8.3" "0.8.2"                                "0.8.1" "0.8.0" "0.7.0" "0.6.1" "0.6.0"                                "0.5.2" "0.5.1" ]  * all SNAPSHOTs:           [ "3.3.0-SNAPSHOT" "3.2.0-SNAPSHOT" "3.0.0-SNAPSHOT" "2.0.0-SNAPSHOT" "0.5.1-SNAPSHOT" ]  * all qualified versions:  [ "3.3.1-1cd4b70" "3.0.0-RC4" "3.0.0-RC3" "3.0.0-RC2" "3.0.0-RC1"                                "3.0.0-alpha1" "1.4.0-alpha1" ]$ lein ancient latest com.taoensso/timbre :allow-all[com.taoensso/timbre "3.3.1-1cd4b70"]
0 0