Code Paths
Path Management
Code Path Contexts:
deps: Dependency ebinsplugins: Plugin ebinsall_deps: All dependencies including project apps
Setting Paths:
rebar_paths:set_paths([deps], State)
rebar_paths:set_paths([deps, plugins], State)
Path Priority
During Compilation:
- Current application's ebin (prepended)
- All dependencies' ebins
- All project apps' ebins
- Rebar3's own dependencies (controlled)
Erlang Code Path:
- Managed via
code:add_patha/1andcode:add_pathz/1 patha: Front of path (higher priority)pathz: End of path (lower priority)
Include Path Resolution
-include_lib("app/include/file.hrl") Resolution:
- Find
appin code path - Look for
include/file.hrlrelative to app directory
Example:
% In code:
-include_lib("cowboy/include/cowboy.hrl").
% Resolves to:
_build/default/lib/cowboy/include/cowboy.hrl