rebar3 erlang 项目管理工具

发布时间 2023-12-22 13:07:30作者: 荣锋亮

rebar3 是erlang 提供的构建,测试以及发布工具

安装

  • 下载
wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
  • 安装
./rebar3 local install

之后配置环境变量

使用

  • 提供的命令
as                Higher order provider for running multiple tasks in a sequence as a certain profiles.
clean             Remove compiled beam files from apps.
compile           Compile apps .app.src and .erl files.
cover             Perform coverage analysis.
ct                Run Common Tests.
deps              List dependencies
dialyzer          Run the Dialyzer analyzer on the project.
do                Higher order provider for running multiple tasks in a sequence.
edoc              Generate documentation using edoc.
escriptize        Generate escript archive.
eunit             Run EUnit Tests.
get-deps          Fetch dependencies.
help              Display a list of tasks or help for a given task or subtask.
new               Create new project from templates.
path              Print paths to build dirs in current profile.
pkgs              List information for a package.
release           Build release of project.
relup             Create relup of releases.
report            Provide a crash report to be sent to the rebar3 issues page.
shell             Run shell with project apps and deps in path.
tar               Tar archive of release built of project.
tree              Print dependency tree.
unlock            Unlock dependencies.
update            Update package index.
upgrade           Upgrade dependencies.
version           Print version for rebar and current Erlang.
xref              Run cross reference analysis.
  • 创建一个简单的erlang 项目
rebar3 new release mydemo

效果

项目结构

 
├── LICENSE.md
├── README.md
├── apps
└── mydemo
└── src
├── mydemo.app.src
├── mydemo_app.erl
└── mydemo_sup.erl
├── config
├── sys.config
└── vm.args
├── rebar.config
└── rebar.lock
  • 编译

  • release

说明

rebar3 是erlang 应用开发的首选工具,官方文档也比较全,可以仔细看看

参考资料

https://github.com/erlang/rebar3
http://rebar3.org/
https://rebar3.org/docs/deployment/releases/