我想在根mix.exs中定义版本。应用程式中的专案可以读取这个版本。可以这样配置吗?
答案 0 :(得分:1)
根mix.exs
:
defmodule MyCoolUmbrellaApp.Mixfile do
use Mix.Project
def project do
[app: :my_cool_umbrella_app,
version: "1.0",
apps_path: "apps",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
end
defp deps do
[
]
end
end
在其中一个应用程序中的代码:
defmodule SomeApp.SomeModule do
def some_function() do
project = Mix.Project.get.project
app = project[:app]
version = project[:version]