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
359 stars 62 forks source link

version 0.1.0 configuration as api but not work #158

Open JaneWardSandy opened 1 year ago

JaneWardSandy commented 1 year ago

Gradle: 8.2 IDEA: 2023.2.2

I have a Gradle with Kotlin project with two modules.

build.gradle.kts file of module A

plugins {
  id("org.openjfx.javafxplugin") version "0.1.0"
}

javafx {
  version = "21"
  configuration = "api"
  modules("javafx.base", "javafx.graphics", "javafx.controls", "javafx.media", "javafx.web")
}

build.gradle.kts file of module B

dependencies {
  api(project(":a"))
}

In the class code of module B, import javafx.application.Application but error Unresolved reference: javafx will be reported.

image

But if I downgrade the plug-in version to 0.0.14, everything will work properly.


Execute B:dependencies -q with 0.0.14

compileClasspath - Compile classpath for null/main.
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.10
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.9.10
|    |    \--- org.jetbrains:annotations:13.0
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10
|         \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.10 (*)
\--- project :A
     +--- org.openjfx:javafx-base:21
     +--- org.openjfx:javafx-graphics:21
     |    \--- org.openjfx:javafx-base:21
     +--- org.openjfx:javafx-controls:21
     |    \--- org.openjfx:javafx-graphics:21 (*)
     +--- org.openjfx:javafx-media:21
     |    \--- org.openjfx:javafx-graphics:21 (*)
     +--- org.openjfx:javafx-web:21
     |    +--- org.openjfx:javafx-controls:21 (*)
     |    \--- org.openjfx:javafx-media:21 (*)
     \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10 (*)

And with 0.1.0

compileClasspath - Compile classpath for null/main.
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.10
|    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.9.10
|    |    \--- org.jetbrains:annotations:13.0
|    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10
|         \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.10 (*)
\--- project :A
     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10 (*)
     +--- org.openjfx:javafx-base:21
     +--- org.openjfx:javafx-graphics:21
     |    \--- org.openjfx:javafx-base:21
     +--- org.openjfx:javafx-controls:21
     |    \--- org.openjfx:javafx-graphics:21 (*)
     +--- org.openjfx:javafx-media:21
     |    \--- org.openjfx:javafx-graphics:21 (*)
     \--- org.openjfx:javafx-web:21
          +--- org.openjfx:javafx-controls:21 (*)
          \--- org.openjfx:javafx-media:21 (*)

Testing project: jfx_demo.zip