为IntelliJ IDEA创建插件。插件与此安装不兼容

时间:2018-02-15 12:25:11

标签: gradle intellij-idea plugins android-studio-3.0 intellij-plugin

我为IntelliJ IDEA创建了一个插件,我想让它在Android Studio和基于IDEA的其他产品上运行。

我使用gradle-intellij-plugin 并有这样的设置:

的build.gradle

buildscript {
    ext.kotlin_version = '1.2.10'

    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    id "org.jetbrains.intellij" version "0.2.17"
    id "org.jetbrains.kotlin.jvm" version "1.2.10"
}
group pluginGroup
version pluginVersion

apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
apply plugin: 'kotlin'


intellij {
    version 'IC-2017.3'
    plugins 'git4idea'
    pluginName "plugin name"
}

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    //...
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

plugins.xml

<idea-plugin>
   ...
   <idea-version since-build="143.379"/>
   <depends>com.intellij.modules.lang</depends>
   <depends>com.intellij.modules.vcs</depends>
   <depends>Git4Idea</depends>
   ...
</idea-plugin>

在IntelliJ上安装IDEA时没有错误。 在Android Studio 3.0.1上安装时出现错误

  

插件&#39;插件名称&#39;与此安装不兼容

如何解决错误?

2 个答案:

答案 0 :(得分:1)

我也遇到了同样的问题,我从plugin.xml解决了它,你也可以在plugin.xml中轻松找到解决方案。

在plugin.xml中,您可以看到:

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="173.0"/>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
   on how to target different products -->
<!-- uncomment to enable plugin in all products
<depends>com.intellij.modules.lang</depends>
-->

我们可以获得两个链接:

  1. http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
  2. http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
  3. 我通过第一个链接解决问题,我认为第二个链接也值得收集。

    进入第一个链接,然后向下滚动您会看到: enter image description here

    所以只需改变

      

    idea-version since-build =&#34; 173.0&#34;

      

    idea-version since-build =&#34; 141&#34;

    现在您可以重试准备插件了。

答案 1 :(得分:0)

С更改了设置,它适用于我

的build.gradle

buildscript {
    ext.kotlin_version = '1.2.10'

    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    id "org.jetbrains.intellij" version "0.2.17"
}
group pluginGroup
version pluginVersion

apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'

sourceCompatibility = 1.8
targetCompatibility = 1.8

intellij {
    version '2017.3'
    plugins 'git4idea'
    pluginName "plugin name"
    updateSinceUntilBuild false
    type 'IC'
}

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile 'com.google.code.gson:gson:2.8.2'
    compile("com.taskadapter:redmine-java-api:3.1.0") {
        exclude group: "org.slf4j"
    }

//    testCompile group: 'junit', name: 'junit', version: '4.12'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

的plugin.xml

<idea-version since-build="141.177"/>
<depends>com.intellij.modules.lang</depends>
<depends>Git4Idea</depends>