最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

kotlin - Intellij plugin Gradle updating: Can't find where `intellijPlatform` and `changeNotes` should be defined - Stac

programmeradmin4浏览0评论

I published an update to an Intellij plugin of mine just a few months ago, but when I went back to work on the same projects again recently I simply couldn't get it to build anymore.

It seems that a lot of the stuff associated with the Gradle build needed to be updated, so I took care of that as best as I could, and now I can build once again. A test deployment of the plugin worked too, so the code is now basically in good working order.

But I had to leave out my old changeNotes to get to this point. This function (which used to work properly) is now declared undefined. The function provides a list of change notes which can be viewed from within the IDE and on the Market Place web page for the plugin.

I think this functionality might now reside in .jetbrains.intellij.platform, but I can't find a way to define intellijPlatform that which doesn't break my build in the attempt.

Here's my current build.gradle.kts

plugins {
  id("java")
  id(".jetbrains.kotlin.jvm") version "1.9.21"
  id(".jetbrains.intellij") version "1.16.1"
  // id(".jetbrains.intellij.platform") version "2.0.1"
}

group = "com.my-domain"
version = "1.0.6"

// Configure Gradle IntelliJ Plugin
// Read more: .html
intellij {
  version.set("2023.1.5")
  type.set("IC") // Target IDE Platform

  plugins.set(listOf(/* Plugin Dependencies */)) // Haven't figured out what dependencies, if any, should go here
}

repositories {
  mavenCentral()

//  intellijPlatform { // Flagged as undefined unless I comment it out
//    releases()
//    marketplace()
//  }
}

tasks {
  // Set the JVM compatibility versions
  withType<JavaCompile> {
    sourceCompatibility = "17"
    targetCompatibility = "17"
  }
  withType<.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions.jvmTarget = "17"
  }

  patchPluginXml {
    sinceBuild.set("231")
    untilBuild.set("241.*")
  }

  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"))
  }
}

tasks.getByName<.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
    // Commented out because it doesn't work anymore as is.
//  changeNotes("""
//    <h2>1.0.5</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.4</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.3</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.2</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.1</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.0</h2>
//    <ul><li>First release</li></ul>
//"""
//  )
}

When it comes to trying to include ".jetbrains.intellij.platform", I get errors about conflicting class definitions, or I'm told I need to use Gradle 8.5 (which I can't figure out how to do, and probably would be barking up the wrong tree anyway), or I get an error like this:

Build file '/Users/username/code/my-project/build.gradle.kts' line: 1

An exception occurred applying plugin request [id: '.jetbrains.intellij.platform', version: '2.0.1']
> Failed to apply plugin class '.jetbrains.intellij.platform.gradle.plugins.project.IntelliJPlatformBasePlugin'.
   > Failed to cast object task ':printBundledPlugins' of type .jetbrains.intellij.tasks.PrintBundledPluginsTask_Decorated to target type .jetbrains.intellij.platform.gradle.tasks.PrintBundledPluginsTask

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at .
BUILD FAILED in 637ms
Configuration cache entry stored.

Any ideas how to fix the problems I'm having here? I'm using IDEA 2023.3.2 on macOS 15.3.

I published an update to an Intellij plugin of mine just a few months ago, but when I went back to work on the same projects again recently I simply couldn't get it to build anymore.

It seems that a lot of the stuff associated with the Gradle build needed to be updated, so I took care of that as best as I could, and now I can build once again. A test deployment of the plugin worked too, so the code is now basically in good working order.

But I had to leave out my old changeNotes to get to this point. This function (which used to work properly) is now declared undefined. The function provides a list of change notes which can be viewed from within the IDE and on the Market Place web page for the plugin.

I think this functionality might now reside in .jetbrains.intellij.platform, but I can't find a way to define intellijPlatform that which doesn't break my build in the attempt.

Here's my current build.gradle.kts

plugins {
  id("java")
  id(".jetbrains.kotlin.jvm") version "1.9.21"
  id(".jetbrains.intellij") version "1.16.1"
  // id(".jetbrains.intellij.platform") version "2.0.1"
}

group = "com.my-domain"
version = "1.0.6"

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
  version.set("2023.1.5")
  type.set("IC") // Target IDE Platform

  plugins.set(listOf(/* Plugin Dependencies */)) // Haven't figured out what dependencies, if any, should go here
}

repositories {
  mavenCentral()

//  intellijPlatform { // Flagged as undefined unless I comment it out
//    releases()
//    marketplace()
//  }
}

tasks {
  // Set the JVM compatibility versions
  withType<JavaCompile> {
    sourceCompatibility = "17"
    targetCompatibility = "17"
  }
  withType<.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions.jvmTarget = "17"
  }

  patchPluginXml {
    sinceBuild.set("231")
    untilBuild.set("241.*")
  }

  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"))
  }
}

tasks.getByName<.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
    // Commented out because it doesn't work anymore as is.
//  changeNotes("""
//    <h2>1.0.5</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.4</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.3</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.2</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.1</h2>
//    <ul><li>Blah, blah, blah.</ul>
//    <h2>1.0.0</h2>
//    <ul><li>First release</li></ul>
//"""
//  )
}

When it comes to trying to include ".jetbrains.intellij.platform", I get errors about conflicting class definitions, or I'm told I need to use Gradle 8.5 (which I can't figure out how to do, and probably would be barking up the wrong tree anyway), or I get an error like this:

Build file '/Users/username/code/my-project/build.gradle.kts' line: 1

An exception occurred applying plugin request [id: '.jetbrains.intellij.platform', version: '2.0.1']
> Failed to apply plugin class '.jetbrains.intellij.platform.gradle.plugins.project.IntelliJPlatformBasePlugin'.
   > Failed to cast object task ':printBundledPlugins' of type .jetbrains.intellij.tasks.PrintBundledPluginsTask_Decorated to target type .jetbrains.intellij.platform.gradle.tasks.PrintBundledPluginsTask

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle..
BUILD FAILED in 637ms
Configuration cache entry stored.

Any ideas how to fix the problems I'm having here? I'm using IDEA 2023.3.2 on macOS 15.3.

Share Improve this question asked 20 hours ago kshetlinekshetline 13.7k6 gold badges49 silver badges90 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I found a way to put my change notes back. It doesn't actually answer my questions about where definitions for intellijPlatform and changeNotes can be found, but it does solve the basic problem that prompted those questions in the first place.

I can simply put my change notes into plugin.xml in very much the same way I had already had a <description> of the plugin in that file.

<change-notes><![CDATA[
  HTML goes here
]]></change-notes>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论