【问题标题】:Why doesn't my Erlang shell load rebar dependencies?为什么我的 Erlang shell 不加载 rebar 依赖项?
【发布时间】:2014-09-18 01:48:56
【问题描述】:

我有一个使用 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 文件,我正在运行命令 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 文件的步骤?

【问题讨论】:

  • 你使用的是什么操作系统?
  • 当你执行application:ensure_all_started(your_application) 时它会返回{ok,[email_address, crypto, asn1, public_key, ssl, gen_smtp, gproc, pat, thrift]}吗?
  • 我在 Windows 上,当我执行 application:ensure_all_started(my_application) 时。我得到{ok,[my_application]}(没有任何依赖项出现)。我注意到如果我添加-pa deps/some_dep/ebin(some_dep 是这些依赖项中的任何一个)application:ensure_all_started(some_dep),则有效,所以似乎没有尊重通配符。

标签: erlang rebar erlang-shell erl reltool


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2011-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-06
    • 2019-03-25
    • 2017-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多