brunomnsilva / JavaFXSmartGraph

Generic (Java FX) Graph Visualization Library
Other
334 stars 56 forks source link

Can not cottect the lib into my JavaFX project. Module smartgraph not found #35

Closed SashaVolushkova closed 8 months ago

SashaVolushkova commented 8 months ago

Steps:

  1. Create JavaFX project with Gradle
  2. add your lib in gradle dependecies
  3. add requires smartgraph; into module-info

I cant run the application - the error is: java.lang.module.FindException: Module smartgraph not found

Please help.

k1ll1n commented 8 months ago

Does the javafx project run normally without smartgraph? What IDE are you using?

SashaVolushkova commented 8 months ago

yes - without smartgraph ieverything is allright IntelliJIdea 2023 Comunity Edition.

k1ll1n commented 8 months ago

image Try running it with gradle.

This is what my module looks like

module com.araksis.demo {
    requires javafx.controls;
    requires javafx.fxml;
    requires javafx.web;
    requires kotlin.stdlib;

    requires org.controlsfx.controls;
    requires com.dlsc.formsfx;
    requires net.synedra.validatorfx;
    requires org.kordamp.ikonli.javafx;
    requires org.kordamp.bootstrapfx.core;
    requires eu.hansolo.tilesfx;
    requires com.almasb.fxgl.all;
    requires smartgraph;

    opens com.araksis.demo to javafx.fxml;
    exports com.araksis.demo;
}

This is what my gradle looks like

plugins {
    id 'java'
    id 'application'
    id 'org.jetbrains.kotlin.jvm' version '1.8.22'
    id 'org.javamodularity.moduleplugin' version '1.8.12'
    id 'org.openjfx.javafxplugin' version '0.0.13'
    id 'org.beryx.jlink' version '2.25.0'
}

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

repositories {
    mavenCentral()
}

ext {
    junitVersion = '5.10.0'
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

application {
    mainModule = 'com.araksis.demo'
    mainClass = 'com.araksis.demo.HelloApplication'
}
kotlin {
    jvmToolchain(17)
}

javafx {
    version = '21'
    modules = ['javafx.controls', 'javafx.fxml', 'javafx.web', 'javafx.swing', 'javafx.media']
}

dependencies {
    implementation('org.controlsfx:controlsfx:11.1.2')
    implementation('com.dlsc.formsfx:formsfx-core:11.6.0') {
        exclude(group: 'org.openjfx')
    }
    implementation('net.synedra:validatorfx:0.4.0') {
        exclude(group: 'org.openjfx')
    }
    implementation('org.kordamp.ikonli:ikonli-javafx:12.3.1')
    implementation('org.kordamp.bootstrapfx:bootstrapfx-core:0.4.0')
    implementation('eu.hansolo:tilesfx:11.48') {
        exclude(group: 'org.openjfx')
    }
    implementation('com.github.almasb:fxgl:17.3') {
        exclude(group: 'org.openjfx')
        exclude(group: 'org.jetbrains.kotlin')
    }

    implementation('com.brunomnsilva:smartgraph:1.0.0')

    testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}

test {
    useJUnitPlatform()
}

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'
    }
}

jlinkZip {
    group = 'distribution'
}

This is a clean demo project, I think yours should look the same.

SashaVolushkova commented 8 months ago

Thanks! All is all right now. I use your samples. I did not use run button from the gradle jobs. I run with Idea button (run main method).

It is important to push run button in gradle commands. I use it in my code and all works all right.

k1ll1n commented 8 months ago

Great, glad it worked out for you! If your problem is resolved, you can close this issue.

Good luck in your endeavors!