Search code examples
buildelixirelixir-mix

alter the location of the _build dir Mix uses


In the process of building project with Mix I have the req of placing the result of the build in another dir.

Mix normally places the build artefacts in /project_path/_build.
I cannot write anything to /project_path during the actual build.

Can I change the output dir? Is this something that can be easily adjusted?


Solution

  • Based on this, you can specify a keyword list member build_path to override the default _build directory.

    Example:

    def project do
        [app: :my_app,
        version: "0.0.1",
        elixir: "~> 1.2",
        build_embedded: Mix.env == :prod,
        start_permanent: Mix.env == :prod,
        build_path: "custom_build_dir",
        deps: deps]
    end