我有两个 Erlang 应用程序:单个应用程序mylogger和伞应用程序myapp。
我想包含 的当前版本作为mylogger的依赖项myapp。
Rebar3 仅建议从 git 添加 deps,例如
{mylogger, {git, "https://github.com/someuser/mylogger", {branch, "master"}}}
Run Code Online (Sandbox Code Playgroud)
或来自 hex.pm。
如何从具有 rebar3 结构的文件系统添加我的自定义应用程序?
创建 escript 应用程序后:
$ rebar3 new escript hello
Run Code Online (Sandbox Code Playgroud)
我可以与 rebar3 一起运行,而不是escriptize先调用吗?
即像这样的东西?
$ rebar3 run
Run Code Online (Sandbox Code Playgroud) 如果我有这样的 OTP 布局:
foo/
- apps/
- bar1/
- src/
- bar2
- src/
Run Code Online (Sandbox Code Playgroud)
如何为和生成 edoc ?bar1bar2
如果我运行:
rebar3 edoc
Run Code Online (Sandbox Code Playgroud)
我得到的是和.html中的单独文件,并且它们之间的链接都不起作用(即导出类型未正确链接)。bar1/docbar2/doc
谢谢。
我\xc2\xb4m 按照Phoenix LiveView Starter中的免费截屏/教程进行操作\n但我\xc2\xb4m 甚至无法启动,mix setup失败原因为:
=ERROR REPORT==== 6-Jul-2022::12:47:58.702361 ===\nbeam/beam_load.c(551): Error loading function rebar3:parse_args/1: op put_tuple u x:\n please re-compile this module with an Erlang/OTP 25 compiler\n\n\nescript: exception error: undefined function rebar3:main/1\n in function escript:run/2 (escript.erl, line 750)\n in call from escript:start/1 (escript.erl, line 277)\n in call from init:start_em/1\n in call from init:do_boot/3\n** (Mix) Could not compile dependency :telemetry, "/Users/martinstabenfeldt/.mix/rebar3 bare compile --paths /Users/martinstabenfeldt/Work/pragmaticstudio.com-liveview-starter/code-bundle/live_view_studio/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile …Run Code Online (Sandbox Code Playgroud) 我可以通过application:start(lager)后面的操作从rebar3 shell手动启动应用程序application:start(myapp).我希望在不必输入它的情况下发生这种情况,例如通过执行一个告诉rebar3运行这些命令的shell脚本.这可能吗?
我创建了一个这样的项目:
$> rebar3 new release foo
$> cd foo
$> rebar3 new app bar
Run Code Online (Sandbox Code Playgroud)
结构如下所示:
$> tree foo
|-- _build
| `-- default
|-- _checkouts
| |-- bar -> ../bar
| `-- rebar.lock
|-- apps
| `-- foo
| |-- include
| | `-- foo.hrl
| `-- src
| |-- foo.app.src
| |-- foo_app.erl
| `-- foo_sup.erl
|
|-- bar
| `-- src
| |-- bar.app.src
| |-- bar_app.erl
| |-- bar_sup.erl
| `-- barlib.erl
|-- config
| |-- sys.config …Run Code Online (Sandbox Code Playgroud) 使用rebar3时,如何为httpc的配置文件设置配置选项?
这是唯一的例子通过是erl -config inets.config看起来像这样:
[{inets,
[{services,[{httpc,[{profile, server1}]},
{httpc, [{profile, server2}]}]}]
}].
Run Code Online (Sandbox Code Playgroud)
我尝试将其应用于rebar3项目结构。
该项目是使用rebar3创建的,具有标准的OTP布局:
rebar3 new release myapp
Run Code Online (Sandbox Code Playgroud)
这是我的myapp/config/sys.config:
[
{ myapp, []},
{inets, [{services, [{httpc, [{profile, myapp}]}]}]}
].
Run Code Online (Sandbox Code Playgroud)
rebar.config:
{erl_opts, [debug_info]}.
{deps, []}.
{relx, [{release, { myapp, "0.1.0" },
[myapp,
sasl]},
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"},
{dev_mode, true},
{include_erts, false},
{extended_start_script, true}]
}.
{profiles, [{prod, [{relx, [{dev_mode, false},
{include_erts, true}]}]
}]
}.
Run Code Online (Sandbox Code Playgroud)
myapp.app.src为了完整性,这是我的文件:
{application, myapp,
[{description, "An OTP application"},
{vsn, …Run Code Online (Sandbox Code Playgroud) 我遇到了 Erlang 20 的有线问题。
我rebar3 as prod tar用来生成一个存档文件,我用它来构建一个基于 .docker 的 docker 镜像erlang:20.2-alpine。
在我的 Macbook Pro 上,可以调用,bin/app start但在目标 docker 容器上,它告诉我:erts-9.2/bin/erlexec: line 1: syntax error: unexpected "("
我的 Macbook Pro 上的 Erlang:
erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V9.2 (abort with ^G)
Run Code Online (Sandbox Code Playgroud)
目标容器上的 Erlang:
erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.2 (abort with ^G)```
Run Code Online (Sandbox Code Playgroud) 我有一个伞式项目,包括 main_app、app1、app2。main_app 可以单独工作,也可以与 app1 和 app2 一起使用并管理它们。
关于启动 app1 和 app2 的决定是在外部(特殊配置文件,由用户填写)。
我使用 rebar.config 的一部分:
{lib_dirs, ["apps"]}.
{sub_dirs, [
"apps/main_app",
"apps/app1",
"apps/app2"
]}.
{relx, [{release, {main_app, "0.8.6"},
[kernel,
sasl,
main_app]},
{sys_config, "./config/sys.config"},
{vm_args, "./config/vm.args"},
{dev_mode, true},
{include_src, true},
{include_erts, false},
{extended_start_script, true}]
}.
{profiles, [
{prod, [
{relx, [
{dev_mode, false},
{include_erts, false},
{include_src, false},
{sys_config, "./config/prod_sys.config"},
{vm_args, "./config/prod_vm.args"}
]}
]}
]}.
Run Code Online (Sandbox Code Playgroud)
如果我使用sudo rebar3 shell- 我可以管理app1和app2。但是,如果我通过 - 打包发行版,sudo rebar3 as prod tar我会得到一个 tar 存档,其中不包含 app1 和 …