How can I import "com.intellij.openapi.vcs.ui.CommitMessage" and "com.intellij.vcs.commit.AbstractCommitWorkflowHandler" in IDEA 2024.2+

已回答

I can't import CommitMessage and AbstractCommitWorkflowHandler in version 2024.2 (it was working fine in older versions), I didn't find any information about the change in the official documentation 

0

Please share your project setup: Gradle Build scripts and plugin.xml files.

1

Thank you for your reply.My file configuration is as follows:

 

# 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=true

# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment

systemProp.org.gradle.unsafe.kotlin.assignment = true



pluginSinceBuild = 211

pluginUntilBuild = 242.*



# I hide the detailes of my plugin here



# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension

platformType = IC

platformVersion = 2024.2

platformPlugins =



# Gradle Releases -> https://github.com/gradle/gradle/releases

gradleVersion = 8.3

 

# build.gradle.kts
import org.jetbrains.changelog.markdownToHTML

fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
    val kotlinVersion = "1.9.10"
    id("java")
    kotlin("jvm") version kotlinVersion
    kotlin("plugin.serialization") version kotlinVersion
    id("org.jetbrains.intellij") version "1.16.1"
    alias(libs.plugins.changelog) // Gradle Changelog Plugin
    alias(libs.plugins.qodana) // Gradle Qodana Plugin
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

repositories {
	mavenCentral()
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
    jvmToolchain(17)
}

intellij {
    pluginName = properties("pluginName")
    version = properties("platformVersion")
    type = properties("platformType")

    plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
}

qodana {
    cachePath = provider { file(".qodana").canonicalPath }
    reportPath = provider { file("build/reports/inspections").canonicalPath }
    saveReport = true
    showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false)
}

tasks {
    wrapper {
        gradleVersion = properties("gradleVersion").get()
    }

    patchPluginXml {
        version = properties("pluginVersion")
        sinceBuild = properties("pluginSinceBuild")
        untilBuild = properties("pluginUntilBuild")

        // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
        pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
            val start = "<!-- Plugin description -->"
            val end = "<!-- Plugin description end -->"

            with (it.lines()) {
                if (!containsAll(listOf(start, end))) {
                    throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
                }
                subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
            }
        }
    }

    signPlugin {
        certificateChain = environment("CERTIFICATE_CHAIN")
        privateKey = environment("PRIVATE_KEY")
        password = environment("PRIVATE_KEY_PASSWORD")
    }

    publishPlugin {
        token = environment("PUBLISH_TOKEN")
        // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
        // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
        // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
        channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
    }
}

When I comment out vcs.ui.CommitMessage and vcs.commit.AbstractCommitWorkflowHandler, I can get 2024.2 to work with this configuration.
I can't provide information about my .xml for confidentiality reasons, but I'm sure it's worked fine before 2024.2, so if necessary, you can just cut to the chase and tell me what changes need to be made in this file to run the 2024.2+ release
 

0

Hi,

Targeting 2024.2 requires using IntelliJ Platform Gradle Plugin 2.x.

Also, even if you stick to 1.x, please always use the latest version (1.17.4). If you used it, you would get the information about 2024.2 requirement. It is highly recommended to use 2.x, though.

0

It still doesn't work, as I said before, my current configuration works fine in IDEA 2024.2 after commenting out the two imports, I used version 1.17.4 as you said (I needed to make sure that my plugin would still work in the older version, so I had to do that), but the CommitMessage and the AbstractCommitWorkflowHandle are still not included in the corresponding libraries, and what bothers me the most is that I can't find the documentation for the changes related to these two libraries, please tell me what to do!

0

You target platformVersion = 2024.2, which doesn't work properly with 1.x. 2.x is required to target 2024.2+. I don't know whether lack of these classes is directly caused by using 1.x with 2024.2, but I can't help you as long as I see the wrong project setup, which may have unknown side effects.

0

请先登录再写评论。