openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
361 stars 62 forks source link

Fixed Kotlin 1.7 not working because of gradle-modules-plugin #135

Closed Nxllpointer closed 2 years ago

Nxllpointer commented 2 years ago

Bumped gradle-modules-plugin to version 1.8.12 because 1.8.12 fixes the Kotlin 1.7 issue.

The error you would get when using Kotlin 1.7:

> Cannot cast org.jetbrains.kotlin.gradle.tasks.KotlinCompile_Decorated to org.gradle.api.tasks.compile.AbstractCompile

It seems to work for me but please test it because I have never used this project before.

The kotlin 1.7 compatible version is available for testing on JitPack: https://jitpack.io/#Nxllpointer/javafx-gradle-plugin-kotlin1_7-fix/9396882eea To use the modified plugin put this in your settings.gradle:

pluginManagement {
    repositories {
        // ...
        gradlePluginPortal()
        maven(url = "https://jitpack.io/")
        // ...
    }
    resolutionStrategy {
        eachPlugin {
            when (requested.id.id) {
                "org.openjfx.javafxplugin" -> useModule("com.github.Nxllpointer.javafx-gradle-plugin-kotlin1_7-fix:javafx-gradle-plugin:9396882eea")
            }
        }
    }
}
// ...
Nxllpointer commented 2 years ago

Is there going to be a new release for this?

ianbrandt commented 2 years ago

As an alternative workaround, I was able to pick this change up from the snapshot repo:

settings.gradle.kts:

pluginManagement {
    repositories {
        gradlePluginPortal()
        maven {
            url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
            mavenContent {
                snapshotsOnly()
            }
        }
    }
}

build.gradle.kts:

plugins {
    kotlin("jvm") version "1.7.20"
    id("org.openjfx.javafxplugin") version "0.0.14-SNAPSHOT"
}

A release for this fix would be greatly appreciated, as Kotlin 1.7 has been out for a while now.