2012-09-08 74 views
4

我想用啤酒作为我的日志工具时,总是得到lager_transform的民主基金的错误,我已经orgnazied我的凸出如下:用啤酒日志框架

proj\ 
    | 
    |--lager\ 
    | |--src\ 
    | |--ebin\ 
    | |--... 
    |  
    |--logserver\ 
    | |--src\ 
    | |--ebin\ 
    | |--rebar.config 
    | |--... 
    | 
    |--rebar 
    | 

然而,当我尝试编译的LogServer,我总是得到了以下错误:

d:\凸出\的LogServer> .. \螺纹钢编译

==> logserver (compile) 
src/logserver_app.erl:none: error in parse transform 'lager_transform': {undef, 
              [{lager_transform, 
               parse_transform, 
               [[{attribute,1,file, 
                {"src/logserver_app.erl",1}}, 
                ... 

谁能知道其中的原因?谢谢!

这些是一些额外的信息:

  • 我使用的是Windows操作系统,并使用最新版本的二郎神和螺纹钢 和啤酒。
  • 啤酒本身已经被编译。我们可以发现在d:\凸出\的LogServer> DIR .. \啤酒\ EBIN \ lager_transform.beam(这将 成功)
  • 螺纹钢的配置文件(d:\凸出\的LogServer \ rebar.config):

    ... {erl_opts,[{parse_transform,lager_transform},debug_info,{d,'TEST'},{i,“include”},{src_dirs,[“src”]}]}。

    {lib_dirs,[“.. \ lager \ ebin”]}。 ...

回答

3

你加啤酒在你rebar.config的依赖?我猜啤酒不在路径中。

rebar wiki

To use lager in your application, you need to define it as a rebar dep or have some other way of including it in erlang’s path. You can then add the following option to the erlang compiler flags:

{parse_transform, lager_transform} 

您可以通过编辑您的rebar.config添加 '啤酒' 作为一个依赖:

%% == Dependencies == 

%% Where to put any downloaded dependencies. Default is "deps" 
{deps_dir, "deps"}. 

%% 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"}}}]}. 

在你的情况,应该是这样的:

{deps, [{lager, ".*", {git, "git://github.com/basho/lager.git", "HEAD"}}]}. 

更多关于钢筋依赖管理器信息:

https://github.com/basho/rebar/wiki/Dependency-management

+0

感谢。但我的啤酒位于我的本地目录。那么如何将它作为依赖项添加? – user1040933

+0

刚刚为啤酒添加了螺纹钢配置。 –

+0

我一直有类似的问题。我已经尝试过以上建议,但没有成功。看到这个:http://stackoverflow.com/questions/20813513/configuring-lager-i-get-this-error-undefined-parse-transform-lager-transform –

5

如果你已经在你的DEPS啤酒然后确保您首先将啤酒依赖于rebar.config,这样的方式会先编译..

+1

我有同样的错误,这个答案适合我。谢谢! –