Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot properly install KxS #2710

Open
WarningImHack3r opened this issue Jun 7, 2024 · 5 comments
Open

Cannot properly install KxS #2710

WarningImHack3r opened this issue Jun 7, 2024 · 5 comments

Comments

@WarningImHack3r
Copy link

WarningImHack3r commented Jun 7, 2024

Describe the bug

Based on https://github.com/JetBrains/intellij-platform-plugin-template, I'm trying to use kotlinx.serialization for a plugin. However, despite multiple attempts with different configurations, I cannot make the plugin to get installed properly: my setup seems to be using an old KxS bundled with Kotlin instead of the one I'm telling it to use.

I tried entirely cleaning my Gradle cache, restarting the IDE, re-building from scratch without cache, hardcoding the dependencies in my kts file... (I've been trying for multiple previous Gradle versions too)

To Reproduce

Use this libs.versions.toml (truncated for brevity):

[versions]
kotlin = "1.9.24"
serializationJson = "1.6.3"

[libraries]
serializationJson = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "serializationJson" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
serialization = { id = "plugin.serialization", version.ref = "kotlin" }

and this build.gradle.kts (truncated for brevity):

plugins {
    id("java") // Java support
    alias(libs.plugins.kotlin) // Kotlin support
    kotlin(libs.plugins.serialization.get().pluginId) version libs.versions.kotlin // Kotlin Serialization support
}

repositories {
    mavenCentral()
    gradlePluginPortal()
}

dependencies {
    implementation(libs.serializationJson)
}

kotlin {
    jvmToolchain(11)
}

Expected behavior

To use the version of the library I want it to use (1.6.3 here)

Environment

  • Kotlin version: [e.g. 1.3.30] 1.9.24
  • Library version: [e.g. 0.11.0] 1.9.24/1.6.3
  • Kotlin platforms: [e.g. JVM, JS, Native or their combinations] JVM
  • Gradle version: [e.g. 4.10] 8.8
  • IDE version (if bug is related to the IDE) [e.g. IntellijIDEA 2019.1, Android Studio 3.4] IDEA U 2024.1.2
  • Other relevant context [e.g. OS version, JRE version, ... ] macOS 14.5, JDK 11
@sandwwraith
Copy link
Member

As far as I understand, you're writing a plugin for IntelliJ. It indeed has some bundled version of serialization, which may not be up-to-date. I suggest you create a ticket in the Intellij platform subsystem (https://youtrack.jetbrains.com/issues/IJPL); maybe they have a solution, as I am not directly involved in it.
What you can do now, perhaps, is to use the Shadow plugin to re-package a required library version into your plugin with a different package.

@WarningImHack3r
Copy link
Author

WarningImHack3r commented Jun 10, 2024

Yep you got it correctly! Sorry for being unclear.
What's the Shadow plugin? Do you think I can try to use the Gradle constraints API to override the bundled dep?

But yeah, I'll create a ticket, thanks!

Edit: opened!

@WarningImHack3r
Copy link
Author

@sandwwraith ok that looks a bit like what I meant to do with Gradle; I'm going to try that filtering thing while the ticket's being processed! Thanks

@WarningImHack3r
Copy link
Author

WarningImHack3r commented Jun 13, 2024

@sandwwraith I can't manage to make it work:

// build.gradle.kts
...

tasks {
    shadowJar {
        relocate("kotlinx.serialization.json", "a") {
            exclude("kotlinx.serialization.json.*")
        }
    }
...

This does absolutely nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants