beryx / badass-jlink-plugin

Create a custom runtime image of your modular application
https://badass-jlink-plugin.beryx.org
Apache License 2.0
379 stars 25 forks source link

Error: Two versions of module javafx.base found #129

Closed ghostman2013 closed 4 years ago

ghostman2013 commented 4 years ago

I am trying to use jlink-plugin to build .app for MacOS, my build.gradle is below:

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
    id "org.beryx.jlink" version "2.17.5"
}

group 'com.contedevel'
version '1.0-SNAPSHOT'

application {
    mainClassName = 'com.contedevel.yummy.App'
    applicationName = 'yummy'
}

javafx {
    version = "14"
    modules = [ 'javafx.base', 'javafx.controls', 'javafx.fxml' ]
}

jlink {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'yummy'
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.controlsfx:controlsfx:11.0.1'
    compile 'org.webjars:font-awesome:5.13.0'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

The problem is when I try to call jpackage, Gradle downloads both variants of JavaFX libraries for Linux and MacOS and I get error: Error: Two versions of module javafx.base found in yummy/build/jlinkbase/jlinkjars (javafx-base-14-mac.jar and javafx-base-14-linux.jar)

How can I resolve this bug?

P.S. I am a beginner in Java world and, honestly, I am not sure if it's a bug of this plugin. If I missed, please, advice where I should ask about that bug then.

siordache commented 4 years ago

Replace the line:

compile 'org.controlsfx:controlsfx:11.0.1'

with

compile('org.controlsfx:controlsfx:11.0.1') {
    exclude group: 'org.openjfx'
}
ghostman2013 commented 4 years ago

Replace the line:

compile 'org.controlsfx:controlsfx:11.0.1'

with

compile('org.controlsfx:controlsfx:11.0.1') {
    exclude group: 'org.openjfx'
}

Thank you very much, it helped! I also have added

jpackage {
    resourceDir = file("$buildDir/resources")
}

to include my resources in app.