0

I want to develop a Plugin for IntelliJ. My version is 2023.2.5. For that I used the New Project wizard with JDK 17. The build.gradle.kts looks like this:

plugins {
    id("java")
    id("org.jetbrains.kotlin.jvm") version "1.9.20"
    id("org.jetbrains.intellij") version "1.15.0"
}

group = "com.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

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

    plugins.set(listOf(/* Plugin Dependencies */))
}

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("222")
        untilBuild.set("232.*")
    }

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

I have installed the Gradle and Kotlin plugin and set my projekt SDK to JDK 17. Yet when I use this import:

import org.jetbrains.kotlin.jvm

I get the error: 'Unresolved reference: kotlin'. I haven't changed the template at all, so I can't pin down the error

I tried changing the SDK to the Kotlin SDK and made sure that the version of JVM target matches the JDK i used. The documentation does not specify what to do when an error occurs and just expects the wizard to behave normally, so I'm really lost here

2
  • 1
    can you show a use case where you import org.jetbrains.kotlin.jvm? It can bring a bit more context about the problem Commented Nov 18, 2023 at 3:10
  • A screenshot might be helpful. Commented Nov 22, 2023 at 11:10

1 Answer 1

1

I had to add org.jetbrains.kotlin as a dependency manually. also kotlin was somehow disabled in the gradle.properties per default so i had to turn that back on. thenit worked after rebuilding

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.