View Source rebar3_hex_build (rebar3_hex v7.0.7)

rebar3 hex build - Build packages and docs

Builds a new local version of your package.

By default this provider will build both a package tarball and docs tarball.

The package and docs .tar files are created in the current directory, but is not pushed to the repository. An app named foo at version 1.2.3 will be built as foo-1.2.3.tar. Likewise the docs .tar would be built as foo-1.2.4-docs.tar.

  $ rebar3 hex build

You may also build only a package or docs tarball utilizing the same available command line options.

  $ rebar3 hex build package
  $ rebar3 hex build docs



Packages are configured via src/<myapp>.app.src attributes.


Required configuration

  • application - application name. This is required per Erlang/OTP thus it should always be present anyway.
  • vsn - must be a valid semantic version identifier.
  • licenses - A list of licenses the project is licensed under. This attribute is required and must be a valid spdx identifier.


Optional configuration

In addition, the following meta attributes are supported and highly recommended :

  • description - a brief description about your application.
  • pkg_name - The name of the package in case you want to publish the package with a different name than the application name.
  • links - A map where the key is a link name and the value is the link URL. Optional but highly recommended.
  • files - A list of files and directories to include in the package. Defaults to standard project directories, so you usually don't need to set this property.
  • include_paths - A list of paths containing files you wish to include in a release.
  • exclude_paths - A list of paths containing files you wish to exclude in a release.
  • exclude_patterns - A list of regular expressions used to exclude files that may have been accumulated via files and include_paths and standard project paths.
  • build_tools - List of build tools that can build the package. It's very rare that you need to set this.

Below is an example :

  {application, myapp,
   [{description, "An Erlang/OTP application"},
    {vsn, "0.1.0"},
    {modules, []},
    {registered, []},
    {applications, [kernel,
    {licenses, ["Apache-2.0"]},
    {links, [{"GitHub", ""}]}]}.


Command line options

  • -r, --repo - Specify the repository to work with. This option is required when you have multiple repositories configured, including organizations. The argument must be a fully qualified repository name (e.g, hexpm, hexpm:my_org, my_own_hexpm). Defaults to hexpm.
  • -u, --unpack - Builds the tarball and unpacks contents into a directory. Useful for making sure the tarball contains all needed files before publishing. See --output below for setting the output path.
  • -o, --output - Sets output path. When used with --unpack it means the directory (Default: <app>-<version>). Otherwise, it specifies tarball path (Default: <app>-<version>.tar). Artifacts will be written to _build/<profile>/lib/<your_app>/ by default.

Link to this section Summary

Link to this section Functions

-spec doc_opts(rebar_state:t(), map()) -> {ok, atom()} | undefined.