引导一个新的 Erlang 项目
要引导新的 Erlang 项目,只需从列表中选择要使用的模板即可。可以通过以下命令检索可用模板:
$ rebar3 new
app (built-in): Complete OTP Application structure
cmake (built-in): Standalone Makefile for building C/C++ in c_src
escript (built-in): Complete escriptized application structure
lib (built-in): Complete OTP Library application (no processes) structure
plugin (built-in): Rebar3 plugin project structure
release (built-in): OTP Release structure for executable programs
选择适当的模板后,使用以下命令引导它(rebar3 将为你的项目创建一个新目录):
$ rebar3 new lib libname
===> Writing libname/src/libname.erl
===> Writing libname/src/libname.app.src
===> Writing libname/rebar.config
===> Writing libname/.gitignore
===> Writing libname/LICENSE
===> Writing libname/README.md
OBS:虽然你可以运行 rebar3 new <template> .
来在当前目录中创建新项目,但不建议这样做,因为引导文件将使用 .
(点)作为应用程序和模块名称以及 rebar.config
,这将导致语法问题。