Right Build Configuration

Answered

Hi Team, The plugin is developed using the IDE version 2024.2.2 

I've not provided until build to support newer versions. I have picked up 223 as sinceBuild by considering the IDE versions starting from 2022.3 (with support for IntelliJ Gradle Plugin 2.x) as mentioned here  https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#requirements and  https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#earlier-versions  

In IDE version 2024.3, I get “Plugin is not compatible with the current version of IDE because it requires build 242.* or older but the current build is IC-243.21565.193” error.

The installation is successful in lower versions such as 2023.3.3 and 2023.1.4. However, during runtime, I see NoSuchMethodError with “editor.getCaretModel().getPrimaryCaret().getLogicalPosition().getColumn()”

Is it that there're going to be issues in lower versions that do not support Gradle 2.x?

What's the right configuration to have the successful installation and run starting from 2022.3 till the newer versions of IDE? 

Here's my configuration. 

build.gradle.kts:

plugins {
    id("java")
    id("org.jetbrains.intellij.platform") version "2.1.0"
}

group = providers.gradleProperty("group").get()
version = providers.gradleProperty("pluginVersion").get()

repositories {
    mavenCentral()
    intellijPlatform {
        defaultRepositories()
    }
}

dependencies {
    intellijPlatform {
        val type = providers.gradleProperty("platformType")
        val version = providers.gradleProperty("platformVersion")
        create(type, version)
        instrumentationTools()
    }
}


tasks {
    withType<JavaCompile> {
        sourceCompatibility = "17"
        targetCompatibility = "17"
    }

    buildSearchableOptions {
        enabled = false
    }
    patchPluginXml {
        sinceBuild = providers.gradleProperty("pluginSinceBuild")
    }
}

gradle.properties:

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false

# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache = true

# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = false

# Plugin Name
pluginName=myPlugin

# Group Id
group=org.mygroup.test

# Plugin Version
pluginVersion=1.0.0

# IDE Configuration
platformType=IC
platformVersion=2024.2.2 # Does this mean the version the plugin was developed? 
pluginSinceBuild=223 # to support IDE versions that can support Gradle 2.x

 

0
4 comments

Hi,

Please see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html#intellijPlatform-pluginConfiguration-ideaVersion-untilBuild

I suggest basing your build script on our template:
https://github.com/JetBrains/intellij-platform-plugin-template/blob/main/build.gradle.kts#L84-L87

In your case, you will need to set until build as:

ideaVersion {
    sinceBuild = providers.gradleProperty("pluginSinceBuild")
    untilBuild = provider { null }
}
0

Thanks, setting untilBuild to null resolves the compatibility issue. I based the build.gradle.kts file (and the related properties files) off of the plugin template. 

1.) I couldn't refer to kotlin's jvmtoolchain. Instead, I can use the below config and believe this is fine.

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

2.) As on today, I'm not relying on any platform plugins and bundled plugins and hence I'm not using the below props and the respective config in build.gradle.kts file. Hope IDE doesn't expect these props for a reason

#platformPlugins =
# Example: platformBundledPlugins = com.intellij.java
#platformBundledPlugins = 

//        // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
//        bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
//
//        // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
//        plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
0
  1. I don't understand what the problem and the question are. If you use Kotlin, you must add the Kotlin plugin to the build script:
    https://github.com/JetBrains/intellij-platform-plugin-template/blob/main/build.gradle.kts#L7
  2. It looks OK.
0

1. I don't use Kotlin as on today and can proceed with the java config without any issues. Thanks

0

Please sign in to leave a comment.