声明捆绑的插件作为IntelliJ IDEA插件的依赖项

问题描述

非捆绑式插件存储在the repository中,并且可以由groupId:artifactId:versionId进行引用,但是the documentation仅表示关于声明对捆绑式插件的依赖性的含糊之处:

找到包含meta-inf/plugin.xml插件主JAR文件 带有标签(或未指定)的描述符。

好的。找到它,然后做什么?

解决方法

我的解决方案是复制gradle IntelliJ插件的模板并复制this example,这使我可以通过没有版本,groupId的插件名称声明依赖项。就我而言,我想使用内置的maven插件中的类,因此我将其添加到了插件= [....]中。该插件将自动获取IntelliJ中该插件的版本。

build.gradle

plugins {
    id 'java'
    id 'org.jetbrains.intellij' version '0.4.26'
}

group 'com.whatever'
version '1.0-SNAPSHOT'
id 'MyPlugin'

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit',name: 'junit',version: '4.12'
    runtime files('maven.jar','libs/gson-2.2.4.jar')
    runtime fileTree(dir: 'libs',include: '*.jar')
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    version '2020.2.2'
    plugins = ['maven']
}

patchPluginXml {
    changeNotes """
      Add change notes here.<br>
      <em>most HTML tags may be used</em>"""
}