From what I understand and read already the problem is that the module is imported twice somewhere, but I don't understand where. This is my module-info.java file:
module main {
requires org.apache.logging.log4j;
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
}
And this is my build.gradle
plugins {
id 'java'
id 'application'
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 'org'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
ext {
junitVersion = '5.10.0'
}
sourceCompatibility = '21'
targetCompatibility = '21'
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
application {
mainModule = 'main'
mainClass = 'main.HelloApplication'
}
javafx {
version = '21'
modules = ['javafx.controls', 'javafx.fxml']
}
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.bootstrapfx:bootstrapfx-core:0.4.0')
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
implementation 'org.apache.logging.log4j:log4j-core:2.22.1'
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api
implementation 'org.apache.logging.log4j:log4j-api:2.22.0'
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
// https://mvnrepository.com/artifact/com.mysql/mysql-connector-j
runtimeOnly 'com.mysql:mysql-connector-j:8.3.0'
}
test {
useJUnitPlatform()
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes('Main-Class': 'main.HelloApplication', 'Multi-Release': 'true')
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
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'
}
I tried changing my module-info file a bunch and if this error is solved then I have a different one each time for example:
module main {
requires org.apache.logging.log4j;
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
requires org.controlsfx.controls;
requires com.dlsc.formsfx;
requires org.kordamp.bootstrapfx.core;
exports main;
exports main.model;
exports main.repository;
exports main.service;
exports main.controller;
opens main;
opens main.model;
opens main.repository;
opens main.service;
opens main.controller;
}
This will now generate "Module main contains package javafx.beans.value, module javafx.base exports package javafx.beans.value to main" or in another run "Module main contains package javafx.event, module javafx.base exports package javafx.event to main".