Building an Erlang project through rebar

Source: Internet
Author: User

1. Create a project folder:

mkdir MYAPPCD MyApp

2. Download the rebar binary file to the folder of this project.

git clone https://github.com/basho/rebar.git;

3. Use the rebar template system to build the "skeleton" of our project.

Rebar Creat-app Appid=myapp

After this command executes, a subfolder "src" is generated in the project file, which contains three files:

Resource files for MYAPP.APP.SRC:OTP applications

Myapp_app.erl: Application behaviour for an OTP application

Myapp_sup.erl: Supervisor behaviour for an OTP application

4. Compiling the project

Rebar Compile

After execution, a Ebin folder will be generated, and the beam file corresponding to the source file under the SRC folder will be produced under Ebin. At the same time, rebar will dynamically generate a suitable OTP project resource file based on the MYAPP.APP.SRC.

In addition, rebar clean can clear the compiled beam file
5. Add Common dependencies
In the project directory (in the same directory as the SRC folder), create a new Rebar.config file with the following file contents:
{erl_opts, [Debug_info,{parse_transform, Lager_transform}]}. {Deps, [  {lager_amqp_backend, '. * ', {git, ' https://github.com/jbrisbin/lager_amqp_backend.git ', ' Master '}},  {amqp_client,   ". *", {git, "https://github.com/jbrisbin/amqp_client.git", {tag, "rabbitmq_2.7.0"}}},  { Ranch, ". *", {git, "https://github.com/ninenines/ranch.git", {tag, "1.1.0"}}},{protobuffs, ". *", "{git," git:// Github.com/basho/erlang_protobuffs.git ", Master}}]}.

After running, rebar get-deps can generate the Deps folder and complete the basic creation.

PS: Purely individual study notes, if there is insufficient please point out, thank you!

Building an Erlang project through rebar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.