mvn-cli
tip
ACCESS-CLI 快速构建Maven多模块应用
#
背景 & 目标目标打造成为满足Access集团开发需求, 简单好用的 Java 服务脚手架工具
工具围绕几个方面进行开发, 力求在以下方面提高开发的工作效率, 同时同过脚手架的方式从一开始就统一下项目结构和模型。
- 深度定制 (定制公司标准的项目结构)
- 快速构建标准的Maven多模块服务
- 支持数据库模型快速安装 (一次配置终生使用, 多快好省)
- 数据库模型文档一键导出 (每次表结构变更, 快速导出最新表文档)
#
一、介绍 | Introduce快速构建支持SpringBoot的Maven多模块应用,启动及快速打包部署
- 支持Maven多模块构建、
- 数据库模型安装、
- 数据库模型导出),
- 统一项目规范,
- 提高工作效率,
- 可进行深度定制。
#
二、快速安装 | Fast installation#
2.1 Node环境安装#
2.2 下载公司 **npm
** 私服(VPN登陆下载)
#
三、功能介绍#
3.1 快速构建 | To quickly build#
3.1.1 命令行构建项目 | Command line build#
3.1.2 idea直接打开 | Use idea to open- 可以点击
run main
启动
#
3.1.3 打包jar文件部署 | Package JAR deployment- 输入
mvn package
快速打包构建部署
- 进入
web/target
目录直接运行启动java -jar ascm-web.jar
#
3.2 安装数据库库模型 | Install the database library model#
3.2.1 配置安装信息 | Configure installation information- 配置项目开发数据库地址
- 配置模型命名规则及安装目录
#
3.2.2 执行命令 | Execute the command如果你是深度命令行换着,你也可以通过纯命令安装
#
3.3 导出数据模型文档 | Export data model documents为了方便我们写技术文档, 支持直接导出成 markdown 格式文档。
#
四、发布记录 | Release record1.0.1
- 构建服务
- 支持注册命令
1.0.2
- 代码精简及优化
- 版本检测及升级
1.0.3
- fix端口号映射问题
1.0.4
- 优化版本检测,在网络差场景的用户体验
#
五、定制 | Custom为了达到深度定制的能力, 你所看到的一切都是可配置的。在模块每一层创建的同时也提供了钩子方法。允许你在钩子节点去做定制开发。**[MavenHooks.js](http://git.idanchuang.net/liuxin/access-cli/blob/master/action/MavenHooks.js)**
欢迎感兴趣的小伙伴一起参与开发, 🚀 call me!
- 微信:
lxchinesszz
- 邮箱:
lxchinesszz@163.com
#
六、扩展知识 | Expand the knowledge项目结构设计支持配置, 在配置前请确定你的编程方法论和价值观。以下文档仅供参考。也是当前工具所保持的价值观。
#
6.1 分层命名 | Hierarchical naming明确业务分层架构,定义领取模型, 编程不迷茫。
#
6.2 数据模型规范 | Data model specification迪米特法则: 不要和陌生人说话,数据模型之间保持最少的了解 迪米特法则: 不要和陌生人说话,数据模型之间保持最少的了
#
七、插件开发 | Plug-in development脚手架工具会将在每个 Maven Module
创建过程中去发出不同对应的事件, 插件开发者可以不同的事件类型来开发插件。
#
7.1 事件类型 | The event type事件类型 | 事件说明 | 环境信息 |
---|---|---|
BUILD_BEFORE | 构建前触发 | |
BUILD_WEB | 构建web层触发 | { |
projectConfig: Object, currentPath: '' } | | BUILDSERVICE | 构建service层触发 | { projectConfig: Object, currentPath: '' } | | BUILD_DOMAIN | 构建domain层触发 | { projectConfig: Object, currentPath: '' } | | BUILD_DAL | 构建dal层触发 | { projectConfig: Object, currentPath: '' } | | BUILD_INTEGRATION | 构建integration层触发 | { projectConfig: Object, currentPath: '' } | | BUILD_CONFIG | 构建config层触发 | { projectConfig: Object, currentPath: '' } | | BUILD_COMMON | 构建common通用层触发 | { projectConfig: Object, currentPath: '' } | | BUILD_COMPLETE | 构建完成触发 | { "namespace":Array[7], "config":Object, "dbConfig":Object, "models":Array[1], "projectConfig":Object } | | BUILD_JAVA_RESOURCE | 构建java资源文件时候触发 | { projectConfig: Object, currentPath: '' } | | BUILD_JAVA_WEB_RESOURCE | 构建java, Web资源文件时候触发_ | { projectConfig: Object, currentPath: '' } |
#
7.2 插件生命周期函数 | Life cycle function#
7.3 插件开发示例 | The sample#
7.3.1 创建目录 | Create a directoryplugins
目录下创建插件子目录
#
7.3.2 实现插件生命周期函数 | Write a function插件支持before、invoke、error、after。插件的核心逻辑在invoke,可以直接实现该方法即可。
所有的声明周期函数都有且只有一个入参,但是不同事件入参信息是不一样的,可以参考 7.1 事件类型, 参数说明。
#
7.3.3 注册开发好的插件 | To register the pluginplugins.Install.js
进行注册
#
7.3.4 完整的参数入参 | Parameters for details- 项目名称
tests
为例