Publishing a Plugin to a Custom Plugin Repository
如果您打算使用插件存储库_ JetBrains插件存储库,
你需要:
*在用于自定义存储库的HTTPS Web服务器上创建和维护updatePlugins.xml
文件.
此文件描述了自定义存储库中可用的所有插件以及每个插件的下载URL.
*将您的插件JAR/ZIP文件上传到HTTPS Web服务器. 这可以是您用于自定义存储库的同一Web服务器 或者不同的HTTPS Web服务器.
*将自定义存储库的URL添加到JetBrains IDE 存储库设置/首选项.
##在updatePlugins文件中描述您的插件
每个自定义插件存储库必须至少有一个updatePlugins.xml
文件来描述最新的可用版本
对于每个托管插件.
JetBrains IDE使用updatePlugins.xml
中的描述来按属性定位插件
例如id,IDE版本和插件版本. JetBrains IDE显示这些属性,以帮助用户选择或升级插件.
该描述还告诉JetBrains IDE在哪里下载插件本身.
自定义插件存储库的updatePlugins.xml
文件由管理员构建和维护
存储库.
如果自定义存储库的使用者使用更多,则可能需要多个updatePlugins.xml
文件
比一个版本的JetBrains IDE.
例如,对于IntelliJ IDEA 2018.2和2018.3,分别为updatePlugins-182.xml
,updatePlugins-183.xml
.
每个updatePlugins - *.xml
文件都有一个添加到JetBrains IDE的唯一URL
updatePlugins文件的格式
updatePlugins.xml
文件的格式只是描述每个插件的顺序元素列表:
<?xml version="1.0" encoding="UTF-8"?>
<!--
The <plugins> element contains the description of the plugins available at this repository. Required.
-->
<plugins>
<!--
Each <plugin> element describes one plugin in the repository. Required.
id - used by JetBrains IDEs to uniquely identify a plugin. Required. Must match <id> in plugin.xml
url - path to download the plugin JAR/ZIP file. Required. Must be HTTPS
version - version of this plugin. Required. Must match <version> in plugin.xml
-->
<plugin id="fully.qualified.id.of.this.plugin" url="https://www.mycompany.com/my_repository/mypluginname.jar" version="major.minor.update">
<!--
The <idea-version> element must match the same element in plugin.xml. Required.
-->
<idea-version since-build="181.3" until-build="191.*" />
</plugin>
<plugin id="id.of.different.plugin" url="https://www.otherserver.com/other_repository/differentplugin.jar" version="major.minor">
<idea-version since-build="181.3" until-build="191.*" />
</plugin>
<plugin>
<!-- And so on for other plugins... -->
</plugin>
</plugins>
Note:
- An
updatePlugins.xml
file must contain at least one set of<plugin></plugin>
elements. - A plugin
id
may be listed only once in anupdatePlugins.xml
file. - Multiple plugins with the same
id
but differentidea-version
attributes must be split into separateupdatePlugins-*.xml
files.
###可选的updatePlugin元素
可以在updatePlugins.xml
中添加其他元素吗?
是的,但仅在需要时才建议.
额外的元素将有
与每个插件的plugin.xml
文件同步.
在插件安装期间,JetBrains IDE读取插件JAR/ZIP文件,然后显示有关插件的更多信息.
哪些附加信息可能有助于用户在何时选择插件
安装前? 答案取决于插件和存储库使用者. 以下是候选元素:
Element | Effects & Requirements |
---|---|
<name> My Plugin Name </name> |
By default the name of the plugin JAR/ZIP file is displayed before installation. Using the <name> element displays the name of the plugin. Contents should match the <name> element contents in the plugins’s plugin.xml file to avoid confusion. |
<description> My plugin is awesome </description> |
By default no description for the plugin is displayed before installation. Using the <description> element will cause a description to be displayed before installation. Contents should match the <description> element contents in the plugins’s plugin.xml file to avoid confusion. Optionally, an enclosing <![CDATA[ ]]> element can be used if the description needs to contain HTML tags. |
<change-notes> Added cool feature </change-notes> |
By default no change notes for the plugin are displayed before installation. Using the <change-notes> element will cause a description of changes to be displayed before installation. Contents should match the <change-notes> element contents in the plugin’s plugin.xml file to avoid confusion. Optionally, an enclosing <![CDATA[ ]]> element can be used if the change notes need to contain HTML tags. |