备注:

项目比较大, 模块比较多,一般使用mix 的方式是大家进行文件夹的划分,但是使用mix 的umbrella 可能会更方便

1. 安装

默认安装elixir 的时候已经包含了这个功能
2. 基本使用
a. 创建根项目

mix new <projectname> --umbrella  

生成的项目如下:

* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating apps
* creating config
* creating config/config.exs Your umbrella project was created successfully.
Inside your project, you will find an apps/ directory
where you can create and host many apps: cd opsplatform
cd apps
mix new my_app Commands like "mix compile" and "mix test" when executed
in the umbrella project root will automatically run
for each application in the apps/ directory. b. 添加子项目 cd <projectname>/apps 我的是opsplatform
cd opsplatform/apps/
mix new platformuserlogin
mix new platformrunnuer
mix new platformdao 项目代码结构如下: ├── apps
│   ├── platformdao
│   │   ├── config
│   │   ├── lib
│   │   └── test
│   ├── platformrunnuer
│   │   ├── config
│   │   ├── lib
│   │   └── test
│   └── platformuserlogin
│   ├── config
│   ├── lib
│   └── test
└── config d. 编译 mix compile # 根项目,进入子模块进行编译也是可以的 e. 模块引用(比如platformrunnuer 需要platformdao) 进入platformrunnuer 编辑 mix.exs defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
{:platformdao, in_umbrella: true}
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
# {:sibling_app_in_umbrella, in_umbrella: true},
]
end
3. 子模块说明
mix.exs

defmodule Platformdao.MixProject do
use Mix.Project # 处理引用的是根目录的,对于配置信息以及依赖可以方便的共享
def project do
[
app: :platformdao,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end # Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end # Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
# {:sibling_app_in_umbrella, in_umbrella: true},
]
end
end
4. 扩展
一般来说我们在使用umbrella 的时候,同时会使用distillery && edeliver
一个负责构建,一个负责部署,还是比较方便的
5. 参考资料
https://hex.pm/packages/edeliver
https://hex.pm/packages/distillery
https://hexdocs.pm/mix/Mix.html
https://github.com/wojtekmach/acme_bank
 
 
 
 

elixir 使用mix umbrella 模块化项目的更多相关文章

  1. 在Android上编写模块化项目(翻译)

    来源博客:Wang Jie's Blog 本文链接:http://blog.wangjiegulu.com/2018/02/13/writing_a_modular_project_on_androi ...

  2. spring-boot 多模块化项目和EurekaServer的搭建

    Spring boot由于其 1.易于开发和维护.2.单个微服务启动快.3.局部修改部署容易.4.技术栈不受语言限制等优点受到越来越多公司的重视.spring-boot还集成了许多关于微服务开发的框架 ...

  3. 简单Elixir游戏服设计- 创建项目

    反正是写到哪算哪. 创建umbrella项目 mix new simple_game --umbrella 创建model项目 cd simple_game\apps mix new model 创建 ...

  4. gulp基于seaJs模块化项目打包实践【原创】

    公司还一直在延续使用jq+seajs的技术栈,所以只能基于现在的技术栈进行静态文件打包,而众所周知seajs的打包比较"偏门",在查了不少的文档和技术分享后终于琢磨出了自己的打包策 ...

  5. springboot之多模块化项目打包

    1.目录结构 2.打成war包,只需在web子项目中的pom文件中添加 <packaging>war</packaging> <build> <!-- 为ja ...

  6. go创建模块化项目

    比如我要创建一个xxx-system,里面可能有多个子模块,步骤如下: 1.mkdir xxx-system 2.cd xxx-system 3.在xxx-system目录下创建一系列的service ...

  7. elixir mix 简介

    概述 mix 是 elixir 工程的构建工具,利用 mix,可以快速方便的创建 elixir 工程,写单元测试,管理 elixir 包的依赖管理等等. 我觉得刚开始学习 elixir 的时候,先简单 ...

  8. laravel elixir

    npm install npm install jquery --save //bootsrap3.36 与 jquery3不兼容,下载jquery时可能需要确定版本号 npm install jqu ...

  9. elixir 集成ejabberd

    备注: 我开发测试的环境时centos 1. 预备环境 1. openssl yum install -y  openssl-devel 2. xml yum install -y expat-dev ...

随机推荐

  1. MVVM模式的3种command总结[2]--RelayCommand

    MVVM模式的3种command总结[2]--RelayCommand RelayCommand本来是WPF下面用的一种自定义的command,主要是它用到了事件管理函数,这个SL下面是没有的.不过这 ...

  2. Pandas:SettingWithCopyWarning

    当我为数据增加新的列的时候,Pandas一直报错:SettingWithCopyWarning 这个问题没有很好地解决方法,因为这个问题也无关大碍,不让Pandas报错就行了. 解决方法: pd.op ...

  3. VS展开当前目录

  4. 转载:【Oracle 集群】RAC知识图文详细教程(四)--缓存融合技术和主要后台进程

    文章导航 集群概念介绍(一) ORACLE集群概念和原理(二) RAC 工作原理和相关组件(三) 缓存融合技术(四) RAC 特殊问题和实战经验(五) ORACLE 11 G版本2 RAC在LINUX ...

  5. This function has none of DETERMINISTIC, NO SQL解决办法

    This function has none of DETERMINISTIC, NO SQL解决办法 创建存储过程时 出错信息: ERROR 1418 (HY000): This function ...

  6. maven_01_简介及安装

    一.简介 Maven主要服务于基于Java平台的项目构建.依赖管理和项目信息管理 何为构建 除了编写源代码,我们每天有相当一部分时间花在了编译.运行单元测试.生成文档.打包和部署等烦琐且不起眼的工作上 ...

  7. iOS 11 实现App在禁止转屏的状态下网页播放器全屏

    禁止转屏是这个意思,在General中设置Device Orientation只有竖屏. 要点就是重写UIViewController的以下3个属性方法 系统的全屏视频播放器是AVFullScreen ...

  8. C# 给窗体添加皮肤 - SkinEngine的应用

    C# 给窗体添加皮肤 - SkinEngine的应用   C#中利用 IrisSkin2.dll 所提供的控件 SkinEngine 来为窗体添加皮肤.这种方法最简单 具体步骤: .添加控件SkinE ...

  9. d3.js(v5.7)的比例尺以及坐标轴

    直接上代码了,这里的一些函数用的是之前我自己封装的函数(包括attr的obj支持和节点数量和数据数量的自动匹配),若有不明白的,可以查看之前的博客: 页面的效果如下: 接下来继续添加坐标轴: 最终:

  10. EasyPlayer Android基于ffmpeg实现播放(RTSP/RTMP/HTTP/HLS)同步录像功能

    之前有博客专门介绍了EasyPlayer的本地录像的功能,简单来说,EasyPlayer是一款RTSP播放器,它将RTSP流里的音视频媒体帧解析出来,并用安卓系统提供的MediaMuxer类进行录像. ...