加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Erlang Rebar 使用指南之四:依赖管理

发布时间:2020-12-13 22:42:18 所属栏目:百科 来源:网络整理
导读:Erlang Rebar 使用指南之四:依赖管理 全文目录: https://github.com/rebar/rebar/wiki 本章链接: https://github.com/rebar/rebar/wiki/Dependency-management 1 rebar依赖定义 Rebar取得和构建符合OTP/Rebar规范的项目。如果项目包含子项目,Rebar会自动

Erlang Rebar 使用指南之四:依赖管理

全文目录:

https://github.com/rebar/rebar/wiki

本章链接:

https://github.com/rebar/rebar/wiki/Dependency-management

1 rebar依赖定义

Rebar取得和构建符合OTP/Rebar规范的项目。如果项目包含子项目,Rebar会自动递归地构建它们。

项目的依赖在project_dir/rebar.config中定义,形式如下:

{deps,[Dependency1,Dependency2,...]}.

其中每一项(Dependency?)都按照{ App,VsnRegex,Source,[raw]}定义:
  • 'App' 指定OTP应用名称,可以是atom或字符串
  • 'VsnRegex' 用于匹配版本号的正则表达式
  • 'Source' 按照下面的格式指定OTP应用的地址:
    {hg,Url,Rev} Fetch from mercury repository
    {git,Url} Fetch from git repository
    {git,{branch,Branch}} Fetch from git repository
    {git,""} == {git,"HEAD"}} Fetch from git repository
    {git,{tag,Tag}} Fetch from git repository
    {git,Rev} Fetch from git repository
    {bzr,Rev} Fetch from a bazaar repository

[raw]是可选的。包含[raw]的依赖项不要求安装Erlang/OTP的项目结构。项目编译时,该依赖项不会自动被编译,但是下面的命令对其有作用:

get-deps
update-deps
check-deps
list-deps
delete-deps

2 rebar.config的例子

{deps,[
    {em,".*",{git,"https://github.com/sheyll/erlymock.git"}},{nano_trace,"https://github.com/sheyll/nano_trace.git","feature/rebar-migration"}}},{mochiweb,"2.3.2","https://github.com/mochi/mochiweb.git","v2.3.2"}}},% Or specify a revision to refer a particular commit,useful if the project has only the master branch
    % {mochiweb,"15bc558d8222b011e2588efbd86c01d68ad73e60"},% An example of a "raw" dependency:
    {rebar,"git://github.com/rebar/rebar.git","master"}},[raw]}
   ]}.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读