引導一個新的 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
,這將導致語法問題。