Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ctoabidmaqbool1 opened this issue Apr 29, 2024 · 1 comment
Open

Comments

@ctoabidmaqbool1
Copy link

ctoabidmaqbool1 commented Apr 29, 2024

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
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants