在我的应用程序中,我的目录结构接近以下内容:
src/
api/
server.erl
model.erl
common/
common_stuff.erl
util.erl
some_app.erl
some_server.erl
something_else.erl
some_app.app.src
驻留在子目录(common、api 等)中的文件以通常的包样式命名。例如,src/common/util.erl 声明为:
-module(common.util).
src/api/server.erl 声明为:
-module(api.server).
等等。
rebar compile 完美运行并在 ebin 中生成适当的子目录树:
ebin/
api/
server.beam
model.beam
common/
common_stuff.beam
util.beam
some_app.beam
some_server.beam
something_else.beam
some_app.app
但是,rebar generate 仅将顶级文件复制到 rel 目录:
rel/some_app/lib/some_app-0.0.2/ebin/
some_app.beam
some_server.beam
something_else.beam
some_app.app
驻留在子目录中的所有内容都不会复制到发布中。因此,当我尝试启动生成的版本时,我会立即收到这种错误消息:
{"init terminating in do_boot",{'cannot load','api.server',get_files}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
我的钢筋生成的 ebin/some_app.app 确实列出了所有必需的模块:
{application,some_app,
[{description,"0.0.2"},
{vsn,"0.0.2"},
{registered,[]},
{applications,[kernel,stdlib,sasl]},
{mod,{some_app,[]}},
{env,[]},
{modules,['api.server','api.model','common.common_stuff',
'common.util', some_app, some_server,
something_else]}]}.
有人知道如何让“钢筋生成”尊重 ebin 的子目录吗?我相信这也可能是 reltool 的问题。
谢谢。