View Source mix compile (Mix v1.14.3)
The main entry point to compile source files.
It simply runs the compilers registered in your project and returns a tuple with the compilation status and a list of diagnostics.
Before compiling code, it loads the code in all dependencies and perform a series of checks to ensure the project is up to date.
:compilers- compilers to run, defaults to
Mix.compilers/0, which are
[:yecc, :leex, :erlang, :elixir, :app].
true, runs protocol consolidation via the
mix compile.protocolstask. The default value is
true, embeds all code and priv content in the
_builddirectory instead of using symlinks.
:build_path- the directory where build artifacts should be written to. This option is intended only for child apps within a larger umbrella application so that each child app can use the common
_builddirectory of the parent umbrella. In a non-umbrella context, configuring this has undesirable side-effects (such as skipping some compiler checks) and should be avoided.
To see documentation for each specific compiler, you must
help directly for the compiler command:
mix help compile.elixir mix help compile.erlang
You can get a list of all compilers by running:
mix compile --list
Command line options
--all-warnings- prints warnings even from files that do not need to be recompiled
--erl-config- path to an Erlang term file that will be loaded as Mix config
--force- forces compilation
--list- lists all enabled compilers
--no-app-loading- does not load .app resource file after compilation
--no-archives-check- skips checking of archives
--no-compile- does not actually compile, only loads code and perform checks
--no-deps-check- skips checking of dependencies
--no-elixir-version-check- does not check Elixir version
--no-optional-deps- does not compile or load optional deps. Useful for testing if a library still successfully compiles without optional dependencies (which is the default case with dependencies)
--no-protocol-consolidation- skips protocol consolidation
--no-validate-compile-env- does not validate the application compile environment
--return-errors- returns error status and diagnostics instead of exiting on error
--warnings-as-errors- exit with non-zero status if compilation has one or more warnings