Adding To Existing Projects
-
使用 Boot 添加命令:将现有项目的代码智能合并到当前项目,重构包结构以匹配,并从临时位置复制所有代码和配置。
-
使用用户定义的命令:使用 Shell 注册命令,操作文件指定所需代码/配置,模板引擎建模内容,操作执行 Shell 操作和 Maven pom.xml 修改等任务。
您可以使用两种方法向现有项目添加代码:
You can use two methods to add code to existing projects:
Using the Boot Add Command
boot add`
命令允许将一个现有项目智能地合并到当前项目中。位于源代码存储库中的现有项目的代码被签出到一个临时目录。然后,现有项目的包结构被重构为与当前项目相匹配。最后,所有代码和配置都被从临时位置复制,在必要情况下创建新文件或更新现有文件。
The boot add`
command allows for intelligent merging of an existing project into the current project.
The code of the existing project, located in a source code repository, is checked out into a temporary directory.
The package structure of the existing project is then refactored to match the current project.
Finally, all code and configuration are copied from the temporary location, creating new files or updating existing ones as necessary.
Using User-Defined commands
您可以使用 Shell 注册您定义的命令。向现有项目添加代码或配置是通过操作文件来完成的,这些操作文件包含有关需要生成什么代码或配置以及如何将其合并到当前项目中的说明。模板引擎使用 Handlebars,对要添加到新文件或注入到现有文件的代码或配置的内容进行建模。此外,操作还可以执行 Shell 操作、修改 Maven pom.xml 文件以及根据需要执行其他任务。
You can register commands that you define with the shell. Adding code or configuration to an existing project is accomplished through action files that contain instructions on what code or configuration needs to be generated and how it should be incorporated into the current project. The template engine uses Handlebars, which models the content of the code or configuration to be added to a new file or injected into an existing file. In addition, actions can execute shell actions, modify the Maven pom.xml file, and perform other tasks as needed.