【问题标题】:How to add extra file or directory while Rebar3 compiling?Rebar3编译时如何添加额外的文件或目录?
【发布时间】:2019-02-07 14:19:55
【问题描述】:

目前我有一个 rebar3 项目,我想为我的应用程序配置使用另一个文件。配置文件名为appConfig.conf,位于conf 目录下。我尝试使用相对路径访问配置文件,但是rebar3没有将conf目录放在_build目录下,导致file not found错误。

目录结构是这样的:

conf/
include/
src/

如何让 rebar3 在编译时考虑conf 目录?

【问题讨论】:

    标签: erlang rebar3


    【解决方案1】:

    当我需要不同的配置文件用于生产或测试模式时,我正在使用 rebar3 配置文件

    结构

    _build
    config
    priv
    src 
    

    这里是 rebar.config 文件的一部分

    {profiles, [
      {production,
        [{relx, [
          {dev_mode,      false},
          {include_erts,  true},
          {include_src,   false},
          {vm_args,       "config/production/vm.args"},
          {sys_config,    "config/production/sys.config"}]
        }]
      },
      {test,
        [{relx, [
          {erl_opts, [{native, o3}]},
          {dev_mode,      false},
          {include_erts,  true},
          {include_src,   false},
          {vm_args,       "config/test/vm.args"},
          {sys_config,    "config/test/sys.config"}]
        }]
      }
    ]}
    

    【讨论】:

    • 这是我推荐作为 rebar3 维护者的方式。
    猜你喜欢
    • 2021-08-20
    • 2013-12-30
    • 1970-01-01
    • 2012-04-02
    • 2013-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-29
    相关资源
    最近更新 更多