Files
docs/versioned_docs/version-2.4/developer-guide/plugin/runtime-mode.md
Ryan Wang 4edbf7e639 docs: update documentation for Halo 2.4 (#203)
为 Halo 2.4 更新文档。

/kind documentation

```release-note
None
```
2023-03-31 03:54:14 +00:00

36 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 插件运行模式
description: 了解插件的运行方式
---
Halo 的插件可以在两种模式下运行:`DEVELOPMENT``DEPLOYMENT`
`DEPLOYMENT`(默认)模式是插件创建的标准工作流程:为每个插件创建一个新的 Gradle 项目,编码插件(声明新的扩展点和/或添加新的扩展),将插件打包成一个 JAR 文件,部署 JAR 文件到 Halo。
这些操作非常耗时,因此引入了 `DEVELOPMENT` 运行时模式。
对于插件开发人员来说,`DEVELOPMENT` 运行时模式的主要优点是不必打包和部署插件。在开发模式下,您可以以简单快速的模式开发插件。
### 配置
如果你想以 `DEPLOYMENT` 运行插件则做如下配置:
```yaml
halo:
plugin:
runtime-mode: deployment
```
插件的 `deployment` 模式只允许通过安装 JAR 文件的方式运行插件。
而如果你想以 `DEVELOPMENT` 运行插件或开发插件则将 `runtime-mode` 修改为 `development`,同时配置 `fixed-plugin-path` 为插件项目路径,可以配置多个。
```yaml
halo:
plugin:
runtime-mode: deployment
fixed-plugin-path:
- /path/to/your/plugin/plugin-starter
```
:::tip Note
插件以开发模式运行时由于插件的加载方式与部署模式不同,如果你此时在 Console 安装插件JAR则会提示插件文件找不到而无法启动。
:::