5

Build compatible plugin Follow

 3 years ago
source link: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003338799-Build-compatible-plugin
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Build compatible plugin – IDEs Support (IntelliJ Platform)

Build compatible plugin Follow

Answered

Avatar
Lrbarykin
Created March 27, 2019 21:14

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

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.

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.

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?

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

ZjMNkgJC1Vrxl-Pt6HD-wQ.jpeg

I use only Idea, not other products.

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.

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

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

My full  closure

patchPluginXml{

    sinceBuild '172'
    untilBuild ''

Works perfect without untilBuild

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.

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"

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).

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

Please sign in to leave a comment.

Didn't find what you were looking for?

New post
Copyright © 2000–2020 JetBrains s.r.o.
Cookies and IP addresses allow us to deliver and improve our web content and to provide you with a personalized experience. Our website uses cookies and collects your IP address for these purposes. Learn more

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK