gluonhq / attach

GNU General Public License v3.0
50 stars 26 forks source link

Two versions of module com.gluonhq.attach.* found, How to solve? #393

Open ctoabidmaqbool1 opened 6 months ago

ctoabidmaqbool1 commented 6 months ago

I am working on javafx modular project! and using latest gluonfx-gradle-plugin too!

when executing jLink or jlinkZip, I am facing these issues, how can I solve one!

> Task :eSalesAnalystApp:jlink
Error: Two versions of module com.gluonhq.attach.lifecycle found in D:\my-app\build\jlinkbase\jlinkjars (lifecycle-4.0.20.jar and lifecycle-4.0.20-desktop.jar)
java.lang.module.FindException: Two versions of module com.gluonhq.attach.lifecycle found in D:\my-app\build\jlinkbase\jlinkjars (lifecycle-4.0.20.jar and lifecycle-4.0.20-desktop.jar)
    at java.base/jdk.internal.module.ModulePath.scanDirectory(ModulePath.java:294)
    at java.base/jdk.internal.module.ModulePath.scan(ModulePath.java:232)
    at java.base/jdk.internal.module.ModulePath.scanNextEntry(ModulePath.java:190)
    at java.base/jdk.internal.module.ModulePath.find(ModulePath.java:154)
    at java.base/java.lang.module.Resolver.findWithBeforeFinder(Resolver.java:842)
    at java.base/java.lang.module.Resolver.resolve(Resolver.java:119)
    at java.base/java.lang.module.Configuration.resolve(Configuration.java:421)
    at java.base/java.lang.module.Configuration.resolve(Configuration.java:255)
    at jdk.jlink/jdk.tools.jlink.internal.Jlink$JlinkConfiguration.resolve(Jlink.java:217)
    at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImageProvider(JlinkTask.java:536)
    at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImage(JlinkTask.java:424)
    at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:276)
    at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:55)
    at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:33)

Some of the codding of build.gradle file

dependencies {
        classpath 'org.javamodularity.moduleplugin:org.javamodularity.moduleplugin.gradle.plugin:1.8.12'
        classpath 'org.beryx.jlink:org.beryx.jlink.gradle.plugin:3.0.0'
        classpath 'org.openjfx:javafx-plugin:0.1.0'
        classpath 'com.gluonhq:gluonfx-gradle-plugin:1.0.22'
}

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'org.javamodularity.moduleplugin'
apply plugin: 'org.openjfx.javafxplugin'
apply plugin: 'com.gluonhq.gluonfx-gradle-plugin'
apply plugin: 'org.beryx.jlink'

gluonfx {
    attachConfig {
        version = '4.0.20'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        services 'lifecycle', 'orientation', 'share', 'storage'
    }
}

jlink {
    imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip")
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'app'
    }

    addExtraDependencies("javafx")
}

jlinkZip {
    group = 'distribution'
}
ctoabidmaqbool commented 6 months ago

I have solved my using following way:

ext.ATTACH_VERSION = "4.0.20"

dependencies {
    implementation "com.gluonhq.attach:util:$ATTACH_VERSION"
    implementation "com.gluonhq.attach:lifecycle:$ATTACH_VERSION:desktop"
    implementation("com.gluonhq.attach:orientation:$ATTACH_VERSION") {
        exclude group: 'com.gluonhq.attach', module: 'lifecycle'
    }
    implementation "com.gluonhq.attach:share:$ATTACH_VERSION"
    implementation "com.gluonhq.attach:storage:$ATTACH_VERSION:desktop"

and removing attachConfig from gluonfx section, but it's not re-commeded way!