升级应用程序 Upgrading an application

当新版本的JHipster发布时,JHipster升级子生成器有助于将现有应用程序升级到新版本,而不会擦除您的更改。

这有助于:

  • 在现有应用程序中拥有最新的JHipster功能
  • 当有重要的错误修复或安全更新时,获取更改
  • 保留您的代码库中的更改,并轻松地将其与新生成的代码合并

在进行升级之前,请仔细阅读本页,了解升级过程的工作原理

要求 Requirements

要使此子生成器工作,您需要 githttp://git-scm.com安装.

运行升级子生成器 Running the upgrade sub-generator

进入应用程序的根目录:

cd myapplication/

要升级您的应用程序,请键入:

jhipster upgrade

以下是您可以通过的选项:

  • --verbose - 详细记录升级过程的每一步
  • --target-version=4.2.0 - 升级到目标版本而不是最新版本,如果项目是后面的几个版本,则很有用
  • --force - 即使没有新的JHipster版本可用,也运行升级子生成器

升级过程的图形视图 Graphical view of the upgrade process

以下是升级过程如何以图形方式工作(请阅读以下部分以获得文字说明):

GitGraph

(这张图片来自 JSFiddle )

Please note that the jhipster_upgrade branch will be created orphan on your project, although it doesn't display correctly on the above graph.

升级过程的逐步说明 Step-by-step explanation of the upgrade process

以下是JHipster升级子生成器处理的步骤::

  1. 检查是否有新版本的JHipster可用 (not applicable if you are using --force).
  2. 检查应用程序是否已被初始化为 git 存储库,否则JHipster将为您初始化一个,并将当前代码库提交给主分支。
  3. 检查以确保存储库中没有未定义的本地更改。如果发现未定义的更改,则进程将退出。
  4. 检查 jhipster_upgrade 分支是否存在。如果没有,将创建一个分支:在“第一次升级中执行的特定步骤”部分中提供有关此步骤的详细信息。
  5. Checkout the jhipster_upgrade branch.
  6. 将JHipster升级到全球最新版本。
  7. 清理当前项目目录。
  8. Re-generate the application using the jhipster --force --with-entities command.
  9. Commit the generated code to the jhipster_upgrade branch.
  10. Merge the jhipster_upgrade branch back to the original branch from where the jhipster upgrade command was launched.
  11. Now you just need to proceed with resolving merge conflicts if there are any.

Congratulations, your application is now upgraded with the latest version of JHipster!

首次升级时执行的具体步骤 Specific steps executed on first upgrade

在JHipster升级子生成器的第一次执行时,为了避免擦除所有更改,将执行一些其他步骤:

  1. A jhipster_upgrade branch is created orphan (it has no parent)
  2. The whole application is generated (using your current JHipster version).
  3. A block-merge commit is made on the master branch: no alteration is made on your codebase on the master branch; this is just a practical way to record in Git that the HEAD of master is up-to-date with the current JHipster version.

忠告 Advice

Don't commit anything on the jhipster_upgrade branch. This branch is dedicated to the JHipster upgrade sub-generator: each time the sub-generator is run, a new commit will be created.

results matching ""

    No results matching ""