2012-09-08 72 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

我有同樣的錯誤,這個答案適合我。謝謝! –