Skip to content
This repository

Commands

Rebar provides support for the most commonly encountered development activities, include:

  • Compilation
  • Unit testing and coverage analysis
  • Documentation generation
  • Dependency management

In addition, it allows for OTP embedded system generation, taking advantage of the template processing afforded by rebar and the reltool application.

The most common commands are:

Command Description
compile Compile all the available source in the project.
eunit Perform unit testing using the EUnit application
doc Generate documentation using the EDoc application
clean Remove any generated artifacts from compilation, unit testing, etc.

Less commonly used commands (in alphabetical order):

Command Description
check-deps Check and display to fetched dependencies specified in rebar.config
create Create a prototypical project (described by the supplied template)
create-app Create a prototypical OTP application (described by the template)
create-node Create a prototypical OTP embedded system (described by the template)
ct Run common_test suites
delete-deps Delete the downloaded source for dependencies specified in rebar.config
escriptize Create stand-alone escript executable using .beam-files in ebin directory
generate Use the reltool application to construct an embedded system
generate-upgrade Build an upgrade package
get-deps Retrieve the source for dependencies specified in the rebar.config
list-deps List the details of the dependencies specified in the rebar.config
update-deps Update the retrieved source for dependencies specified in the rebar.config
xref Use the xref application to analyze dependencies

Supported Source Formats

Rebar is capable of compiling a number of different source files via the "compile" command.

Source Target Description
src/*.erl ebin/*.beam Erlang source files
src/*.app.src ebin/*.app Erlang application specification
c_src/*.c priv/<app>.so C code for a port driver or NIF shared library
mibs/*.mib priv/mibs/*.bin SNMP mib files
src/*.xrl src/*.erl Leex analyzer generator files
src/*.yrl src/*.erl Yecc parser generator files
asn1/*.asn1 src/*.erl ASN-1 files
templates/*.dtl ebin/*_dtl.beam ErlyDTL template files (requires ErlyDTL to be installed)
src/*.lfe ebin/*.beam LFE source files (requires LFE to be installed)
src/*.peg ebin/*.beam Neotoma PEG grammars (requires Neotoma to be installed)
src/*.proto ebin/*_pb.beam, include/*_pb.hrl Protocol Buffers specifications (requires protobuffs to be installed)

Options

Options for the various commands are given in the rebar.config configuration file. They are listed, below.

Command Options Description
compile erl_first_files The list of Erlang source files that should be compiled ahead of any other (for example, behavior modules)
compile erl_opts The options supported by the compile module, as described here
compile mib_first_files The list of mib files that should be compiled ahead of any other (for example, RFC mibs which are referenced in a mib file's IMPORTS section)
compile src_dirs List of directories containing Erlang source files
compile erlydtl_opts See ErlyDTL for details on the supported options
clean clean_files List of files to delete; this is in addition to the files deleted by the clean command for a specific module
doc edoc_opts The options supported by the edoc module, as described here
escriptize escript_name The output filename for the escript (may include directories)
escriptize escript_incl_apps A list of other applications to include in the escript archive
escriptize escript_shebang The shebang line to prepend to the escript file (defaults to "#!/usr/bin/env escript\n")
escriptize escript_comment A comment to add at the top of the escript file (defaults to "%%\n")
escriptize escript_emu_args Arguments to pass to the Erlang emulator when running the escript, as described here (defaults to "%%!\n")
eunit eunit_opts The options supported by the eunit module, as described here
eunit cover_enabled Enable coverage analysis of Erlang programs
eunit eunit_compile_opts Same options as erl_opts to be used for eunit specific compile settings in addition to erl_opts
eunit eunit_first_files The list of EUnit Erlang source files that should be compiled ahead of any other (for example, behavior modules)
get-deps, delete-deps deps_dir Specify alternative directory for storing deps
get-deps, delete-deps deps List of dependencies
generate target_dir Target directory
generate overlay_vars Overlay variables file
xref xref_warnings Enable xref warnings
xref xref_checks The options supported by the xref module analyze/2 functions, as described here
xref xref_queries Custom xref queries (xref manual has details) specified as {xref_queries, [{query_string(), expected_query_result()},...]}
Something went wrong with that request. Please try again.