git4idea doesnt compile with the latest versions & How to deal with @deprecations
If i compile/update with gradle to develope my plugin i get:
Cannot find builtin plugin 'git4idea' for IDE: /mnt/data/home/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/LATEST-EAP-SNAPSHOT/ab7079e3a3098a8bb4596d4269d5ec9a7120800/ideaIU-LATEST-EAP-SNAPSHOT
plugins.set(listOf("git4idea"))
// version.set("LATEST-EAP-SNAPSHOT") // git4idea build issue
// version.set("2022.3.1") // git4idea build issue
// version.set("2022.3") // git4idea build issue
version.set("2022.2") // works
Another Question:
How to deal with @deprecation, @availableSince and sinceBuild.set(). On the one side ive been forced to support older Versions and on the other side i should avoid using deprecated functions. I cannot do both.
Please sign in to leave a comment.
Hi Michael,
Please use
Git4Idea
(not lowercasegit4idea
) plugin ID.Regarding the deprecations, there is no easy answer.
You should balance between providing support for the required set of versions and keeping the code compatible with the supported versions. Deprecations should be fixed at some point, but it is not required and rarely possible to have 0 Plugin Verifier issues.
It is recommended to support the last three major versions: https://plugins.jetbrains.com/docs/marketplace/product-versions-in-use-statistics.html
If for some reason compatibility cannot be achieved in the code, you may consider releasing separate plugin versions targeting different platform versions, e.g., by maintaining separate code branches.
I have been able to build the plugin as you suggested. But for my plugin when install it in PHPStrom 2023.3.2, it installs well. Second time I launch the IDE, I get this error after chaning git4ieda to Git4Idea.
Plugin 'Branch Magic' requires plugin 'com.intellij.modules.git4idea' to be installed.
Here is my build.gradle.kts file:
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.0"
id("org.jetbrains.intellij") version "1.15.0"
}
group = "net.example"
version = "1.0.0"
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.12.5")
implementation("com.fasterxml.jackson.dataformat", "jackson-dataformat-xml", "2.12.5")
}
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2023.3.2")
type.set("IC") // Target IDE Platform
type.set("IU") // Target IDE Platform
type.set("PS") // Target IDE Platform
plugins.set(listOf("Git4Idea", "com.jetbrains.plugins.webDeployment"))
}
tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
patchPluginXml {
sinceBuild.set("232")
untilBuild.set("260.*")
}
signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}
Is there anything wrong here?
Hi Abdul,
Sorry for the delay. I don't understand the issue. Does it work correctly and after restart it does not? What does the restart mean? Is it a sandbox development instance? Do you install any plugins manually in the first run? What is Branch Magic plugin? Is it yours?
Hi Karol,
No problem. It has been sorted. The plugin dependency should be “Git4Idea”.
I also modified the namespaces which actually caused the issue!
Anyway, thank you.