1

我有一个使用 rebar 和这个配置的简单项目:

  {sub_dirs, [
              "gen",
              "apps/basilisk_server",
              "rel"
              "apps/*"
              "ebin"
              "deps/*/ebin"
             ]}.

  {erl_opts, [debug_info, fail_on_warning]}.


  { 
    deps, 
    [
     { email_address, ".*", { git, "git://github.com/mswimmer/erlang-email-address.git", "master"}},

     { gen_smtp     , ".*", { git, "https://github.com/Vagabond/gen_smtp.git"          , "master"}},
     { pat          , ".*", { git, "https://github.com/selectel/pat.git"               , "master"}},
     { thrift          , ".*", { git, "https://github.com/MustyMustelidae/ThriftErl.git", "master"}}
    ]
  }.

我的目录结构是:

            +---.rebar
            +---deps
            |   +---edown
            |   |   +---.rebar
            |   |   +---bin
            |   |   +---doc
            |   |   +---ebin
            |   |   +---priv
            |   |   |   \---scripts
            |   |   +---samples
            |   |   \---src
            |   +---email_address
            |   |   +---.rebar
            |   |   +---ebin
            |   |   +---src
            |   |   \---test
            |   +---gen_smtp
            |   |   +---.rebar
            |   |   +---ebin
            |   |   +---src
            |   |   +---test
            |   |   \---testdata
            |   +---gproc
            |   |   +---.rebar
            |   |   +---doc
            |   |   +---ebin
            |   |   +---include
            |   |   +---patches
            |   |   |   +---gen_leader
            |   |   |   +---kernel
            |   |   |   \---stdlib
            |   |   +---priv
            |   |   +---reference
            |   |   +---src
            |   |   +---test
            |   |   |   \---eqc
            |   |   \---tetrapak
            |   +---lager
            |   |   +---.rebar
            |   |   +---ebin
            |   |   +---include
            |   |   +---src
            |   |   \---test
            |   +---pat
            |   |   +---.rebar
            |   |   +---ebin
            |   |   +---include
            |   |   \---src
            |   +---proper
            |   |   +---.rebar
            |   |   +---doc
            |   |   +---ebin 
            |   |   +---examples
            |   |   +---include
            |   |   +---src
            |   |   \---test
            |   +---tempo
            |   |   +---.rebar
            |   |   +---c_src
            |   |   +---doc
            |   |   |   \---utf8
            |   |   +---ebin
            |   |   +---src
            |   |   \---test
            |   \---thrift
            |       +---.rebar
            |       +---ebin 
            |       +---include
            |       +---out
            |       |   \---production
            |       |       \---erl
            |       +---src
            |       \---test
            +---ebin <--- My .app/.beam
            \---src <--- My source files
                \---gen <---More source files

(对墙感到抱歉)每个依赖项的 ebin 文件夹中都有一个 .app 文件,我正在运行 command erl -pa apps/*/ebin -pa ebin -pa deps/*/ebin。我希望我应该能够application:ensure_all_started(somedep).在“somedep”是依赖项的名称的地方运行,并且在它的 ebin 文件夹中定义了一个 .app。但是当我为其中任何一个运行它时,我得到了错误{error,{somedep,{"no such file or directory","somedep.app"}}}。当我为自己的应用程序运行它时,我得到了正确的响应({ok,_})。因为我无法启动依赖项的应用程序,所以我自己的应用程序失败并出现undef错误。我是否错过了向 shell 注册我的 .app 文件的步骤?

4

1 回答 1

3

Windows 命令外壳不会扩展 and 中的通配符apps/*/ebindeps/*/ebin因此 Erlang 加载路径没有正确设置。

于 2014-07-27T01:35:58.647 回答