-1

我的应用程序使用 Mochiweb。

我注意到 Mochiweb 文件驻留在myapp/deps/mochiweb目录中,rebar并在我在目录中运行 make 时编译它们myapp

我想添加ibrowse一些测试来向我的应用程序发出 http 请求。所以我ibrowse从github克隆到myapp/deps/ibrowse目录。

但似乎 Erlang 不知道从哪里获取.beam文件ibrowse,因此我使用该ibrowse模块的所有测试都失败了:

myapp
 ebin %%compiled tests reside here, tests which use ibrowse fail (badarg)
 deps
  mochiweb 
  ibrowse
   ebin %%compiled ibrowse module resides here
 src
 tests

如何让基于 Mochiweb 的应用程序使用其他 Erlang/OTP 外部库?

我应该为此编辑 rebar.config 或 Makefile 吗?或者我应该编辑一个 _app.src 文件?

编辑:也许我应该编辑 myapp_sup.erl 文件中的目录列表?( myapp_deps:local_path(["priv", "www"])

PS 我的应用程序如何知道所有 mochiweb.beam 文件所在的位置?(例如,泛型myapp_web.erl使用了对mochiweb_http模块的调用,但目录中没有mochiweb_http.beammyapp/ebin

4

2 回答 2

0

rebar 中的依赖项是通过 rebar.config 文件添加的:

%% What dependencies we have, dependencies can be of 3 forms, an application
%% name as an atom, eg. mochiweb, a name and a version (from the .app file), or
%% an application name, a version and the SCM details on how to fetch it (SCM
%% type, location and revision). Rebar currently supports git, hg, bzr and svn.
{deps, [application_name,
        {application_name, "1.0.*"},
        {application_name, "1.0.*",
         {git, "git://github.com/basho/rebar.git", {branch, "master"}}}]}.

然后,您可能想查看 Erlang 版本和使用 rebar 的版本处理。将发布视为对应用程序进行分组的一种方式。

http://www.erlang.org/doc/design_principles/release_handling.html

http://learnyousomeerlang.com/release-is-the-word

https://github.com/basho/rebar/wiki/Release-handling

于 2012-05-18T06:58:22.570 回答
0

将以下代码添加到 myapp_web.erl 解决了我的问题:

ibrowse:start()

默认情况下,Mochiweb 以相同的功能启动:

mochiweb_http:start()...

我不确定这是否是正确的方法,但它有效。

于 2012-05-18T23:36:18.400 回答