Rebar and generated .erl files

Tim Watson watson.timothy at
Mon Feb 6 12:02:45 EST 2012

Not sure how you call protoc-gen-erl but you can do this prior to rebar
compiling your sources by adding either adding to your rebar.config
`{pre_hooks, [{compile, "<GEN_CMD>"}]}` or adding a plugin to your build
which hooks the `pre_compile/2` command API - see for more details. You
can then put the sources separately by doing this:

{erl_opts, [{src_dirs, ["src", "generated"]}]}.

But of course, rebar already has a protocol buffers compiler:
This just looks in the "src" directory for .proto files. I'm not sure what
underlying implementation it uses though.


On 6 February 2012 16:01, Ransom Richardson <ransomr at> wrote:

>  I'm new to Erlang and Rebar. My project uses protoc-gen-erl (
> to generate .erl files from
> protocol buffer .proto files. I am trying to find a good way to deal with
> these generated files in rebar.
>  It seems like the simplest thing to do would be to put the generated
> files in the src directory for my app. But I was wondering if there is a
> way that would better keep the generated files separate from my actual
> sources.
>  thanks for any help,
> Ransom
> _______________________________________________
> rebar mailing list
> rebar at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rebar mailing list