Build compatible plugin

Answered

Greetings!

I have created Intellij Idea plugin I would like to use with number of releases (since 2017). But when I try to use it with idea that diifers from one specified in build.gradle:

intellij{

    version: 2018.2

}

I got error "Plugin is incompatible with this installation".

My plugin.xml contains <idea-version since-build="171"/>

How can I build compatible plugin.

13 comments
Comment actions Permalink

Please provide full build.gradle and plugin.xml

I don't understand why you would want to compile against 2018.2 while your plugin.xml contains 171 as minimum version - that might introduce unwanted API incompatibilities if you use API introduced in later versions.

1
Comment actions Permalink

I am currently using 2018.2 idea, but my colleagues use variety of versions (since 2017 to 2018.3) and I want my plugin to be compatible with all of them.

Here is my build.gradle:

plugins {
id 'org.jetbrains.intellij' version '0.3.6'
}

group 'com.sbt.smart.cloud.im'
version '1.2-2018.3'

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

sourceCompatibility = 1.8

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}

intellij {
version '2018.3'
pluginName 'adapters-plugin'
}

and plugin.xml:

<idea-plugin>
<id>adapters-plugin</id>
<name>adapters-runner</name>
<vendor email="">Barykin-LR</vendor>

<idea-version since-build="171"/>
<description><![CDATA[
<br>
]]></description>

<extensions defaultExtensionNs="com.intellij">
<toolWindow id="Adapters runner" anchor="right" factoryClass="PluginWindowFactory" icon="/Content/icon.png" />
</extensions>
</idea-plugin>

Thanks for your help.

1
Comment actions Permalink

Why don't you compile against 2017.1? Please use latest gradle plugin (0.4.7 instead of 0.3.6)

Please show screenshot/full stacktrace of "I got error "Plugin is incompatible with this installation"." Right now, your plugin is compatible with IntelliJ IDEA only, did you try to install it in other IDEs?

1
Comment actions Permalink

Since I work in closed contour, the latest version of gradle plugin is 0.4.2, but when I try to use it, I get error 

A problem occurred configuring root project 'adapters-plugin'.

> Failed to notify project evaluation listener.

   > org/apache/commons/io/FileUtils

Here is screenshot of error I get when use plugin built for 2017 idea with 2018 versions

I use only Idea, not other products.

1
Comment actions Permalink

Ok, please then revert to latest version that works in your environment.

You'll need to set "since/until-build" in "patchPluginXml" closure of your build.gradle explicitly, otherwise it will default to the platform's version you're using to compile against. See https://github.com/JetBrains/gradle-intellij-plugin/#patching-dsl for more details. Please double-check output of Gradle console which should have given hint about overriding these values.

0
Comment actions Permalink

Thank you very much! Plugin started working with previous versions great!

But there is one more question: how to remove "until-build" from plugin.xml?

If I use 

patchPluginXml{
    untilBuild ''

}

I get the same error as on the screenshot

 

1
Comment actions Permalink

You still don't set since-build in your patchPluginXml closure, so defaults will be applied, see above link

1
Comment actions Permalink

My full  closure

patchPluginXml{

    sinceBuild '172'
    untilBuild ''

}

Works perfect without untilBuild

1
Comment actions Permalink

Do you have updateSinceUntilBuild=true in your build.gradle? Please check gradle messages carefully and show full build.gradle if it still doesn't work.

1
Comment actions Permalink

Thanks for your help~

0
Comment actions Permalink

Hello, sorry to reopen this post, but i think to occure the same case.

If I write

intellij {
version '2019.3.4'
}

I can run the project only on this version (and the plugin works well). But I want to enable all recent IDEA versions. So I tried this :

patchPluginXml {
sinceBuild '191'
untilBuild ''
}

And I can install the plugin on every versions but i have this error in my plugin "java.lang.NoSuchFieldError: Companion"

I tried to write this :

intellij {
updateSinceUntilBuild = false
}

It works for the latest version IDEA without error, but for older versions i still have the error "java.lang.NoSuchFieldError: Companion"

 

0
Comment actions Permalink

Williamvignoles, always set `intellij.version` to minimum required target platform and do NOT override sinceBuild manually with lower version (in this case, 191 << 2019.3).

0
Comment actions Permalink

Great ! It works, thank you very much Yann :)

0

Please sign in to leave a comment.