javafx-gradle-plugin icon indicating copy to clipboard operation
javafx-gradle-plugin copied to clipboard

Cannot choose between the following variants of JavaFX component modules like org.openjfx:javafx-fxml:21

Open DaiYuANg opened this issue 2 years ago • 3 comments

When I upgraded the plugin to version 0.1.0, I encountered an Cannot choose between the following variants of JavaFX component modules error. I've already found a solution in the project's README, but my understanding of Gradle is still quite basic. Could someone help me take a look? There is my build.gradle.kts

plugins {
    id("org.javamodularity.moduleplugin")
    id("org.beryx.jlink")
    application
}

dependencies {
    implementation("io.vertx:vertx-core:4.4.5")
    implementation("io.github.mkpaz:atlantafx-base:2.0.1")
    implementation("com.github.oshi:oshi-core-java11:6.4.6")
    implementation("com.google.code.gson:gson:2.10.1")
    implementation("com.dlsc.preferencesfx:preferencesfx-core:11.16.0")
    implementation("commons-io:commons-io:2.14.0")
    implementation("org.apache.commons:commons-configuration2:2.9.0")
    implementation("com.dustinredmond.fxtrayicon:FXTrayIcon:4.0.1")
    implementation("dev.dirs:directories:26")
    implementation("io.ebean:ebean:13.15.0-jakarta")
    implementation("io.ebean:ebean-querybean:13.15.0-jakarta")
    implementation("io.ebean:ebean-sqlite:13.22.1-jakarta")
    implementation("com.fasterxml.jackson.core:jackson-databind:2.15.2")
    implementation("org.xerial:sqlite-jdbc:3.43.0.0")
    testImplementation("io.ebean:ebean-test:13.15.0-jakarta")
    testImplementation("org.testfx:testfx-junit5:4.0.16-alpha")
    testImplementation("io.vertx:vertx-junit5:4.4.5")
    annotationProcessor("io.ebean:querybean-generator:13.15.0-jakarta")
}

application {
    mainModule.set("org.xxx.xxx")
    mainClass.set("org.xxx.xxx.XXXApplication")
}

configurations{
    all{
        exclude("javax.annotation",module = "javax.annotation-api")
        exclude("javax.annotation",module = "javax.annotation-api")
    }
}

java {
    modularity.inferModulePath.set(false)
}

jlink {
    imageZip.set(project.file("${layout.buildDirectory}/distributions/app-${javafx.platform.classifier}.zip"))
    launcher { name = "VisualModeling" }
    group = "distribution"
    mergedModule {
        requires("org.slf4j")
        requires("jakarta.inject")
        requires("jakarta.annotation")
    }
}



jlink{
    forceMerge("org.slf4j")
//    forceMerge{
//        additive = true
//        requires("org.slf4j")
//    }
}

And there is root projectbuild.gradle.kts

subprojects {
    apply {
        plugin("org.openjfx.javafxplugin")
        plugin("io.freefair.sass-java")
    }

    javafx {
        version = "21"
        modules = listOf(
            "javafx.controls",
            "javafx.fxml",
            "javafx.media",
            "javafx.media",
            "javafx.web",
            "javafx.swing"
        )
        configurations = arrayOf("implementation", "testImplementation")
    }
}

DaiYuANg avatar Oct 09 '23 14:10 DaiYuANg