Clone wiki

rebar / Commands


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

  • compilation
  • unit testing and coverage analysis
  • static analysis (through Dialyzer and Xref).
  • 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:

compileCompile all the available source in the project.
eunitPerform unit testing using the Eunit application
docGenerate documention using the Edoc application
cleanRemove any generated artifacts from compilation, unit testing, etc.

Less commonly used commands (in alphabetical order):

analyzePerform static analysis on the project using Dialyzer
build_pltBuild the Dialyzer PLT; see the Dialyzer documentation for more details
check_pltCheck whether the Dialyzer PLT is up-to-date, rebuilding it if necessary
createCreate a prototypical project (described by the supplied template)
create-appCreate a prototypical OTP application (described by the <<file priv/templates/simpleapp.template>> template)
create-nodeCreate a prototypical OTP embedded system (described by the <<file priv/templates/simplenode.reltool.config>> template)
delete-depsDelete the downloaded source for dependencies specified in rebar.config
generateUse the Reltool application to construct an embedded system
get-depsRetrieve the source for dependencies specified in the rebar.config
xrefUse the Xref application to analyze dependencies

Supported Source Formats

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

src/*.erlebin/*.beamErlang source files
src/*.app.srcebin/*.appErlang application specification
c_src/*.cpriv/<app>.soC code for a port driver or NIF shared library
mibs/*.mibpriv/mibs/*.binSNMP mib files
src/*.xrlsrc/*.erlLeex analyzer generator files
src/*.yrlsrc/*.erlYecc parser generator files
asn1/*.asn1src/*.erlASN-1 files
templates/*.dtlebin/*_dtl.beamErlyDTL template files (requires ErlyDTL to be installed)
src/*.lfeebin/*.beamLFE source files (requires LFE to be installed)
src/*.pegebin/*.beamNeotoma PEG grammars (requires Neotoma to be installed)
src/*.protoebin/*_pb.beam, include/*_pb.hrlProtocol Buffers specifications (requires protobuffs to be installed)


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

compileerl_first_filesThe list of erlang source files that should be compiled ahead of any other (for example, behavior modules)
compileerl_optsThe options supported by the compile module, as described, here
compilemib_first_filesThe 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)
compilesrc_dirsList of additional directories (beyond the src directory) containing Erlang source files
compileerlydtl_optsSee ErlyDTL Templates for details on the supported options
cleanclean_filesList of files to delete; this is in addition to the files deleted by the clean command for a specific module
docedoc_optsThe options supported but the edoc module, as described, here
euniteunit_optsThe options supported but the eunit module, as described, here
eunitcover_enabledEnable coverage analysis of Erlang programs
euniteunit_compile_optsSame options as erl_opts to be used for eunit specific compile settings in addition to erl_opts
analyzedialyzer_optsSpecify alternative Dialyzer PLT file
build_pltdialyzer_optsSpecify alternative Dialyzer PLT file
check_pltdialyzer_optsSpecify alternative Dialyzer PLT file
get-deps, delete-depsbase_dirSpecify alternative base directory for deps_dir
get-deps, delete-depsdeps_dirSpecify alternative directory for storing deps
get-deps, delete-depsdepsList of dependencies
generatetarget_dirTarget directory
generateoverlay_varsOverlay variables file
xrefxref_warningsEnable xref warnings
xrefxref_checksThe options supported by the xref module analyze/3 functions, as described, here