Solution: Thanks to jewelsea's comment here I switched the project to Maven and won't be using Gradle anymore.
I try to include Saxon-HE within a modular Gradle project, based on the autogenerated JavaFX project within intellij. The error message I get when running in Intellij is:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module Saxon.HE not found, required by org.proj.xslgui
Dependencies in build.gradle
:
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.13'
id 'org.beryx.jlink' version '2.25.0'
}
group 'org.proj'
version '1.0'
repositories {
mavenCentral()
}
ext {
junitVersion = '5.9.1'
}
sourceCompatibility = '17'
targetCompatibility = '17'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
application {
mainModule = 'org.proj.xslgui'
mainClass = 'org.proj.xslgui.HelloApplication'
}
javafx {
version = '17.0.2'
modules = ['javafx.controls', 'javafx.fxml']
}
dependencies {
implementation("net.sf.saxon:Saxon-HE:11.4")
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'
}
The main part of the build.gradle
is autogenerated by intellij.
My settings.gradle
:
rootProject.name = "XSLGui"
My module-info.java
:
module org.proj.xslgui {
requires javafx.controls;
requires javafx.fxml;
requires java.xml;
requires Saxon.HE;
opens org.proj.xslgui to javafx.fxml;
exports org.proj.xslgui;
}
The Saxon.jar shows up in the external libraries. And within the classes everything gets resolved just fine. I have no idea why it can't find the modul, ... intellij itself autogenerated the require Saxon.HE
in the module-info.java
... I think Saxon just isn't a module at all (can't find a module-info.java), so maybe that's where the problem starts...
I expected that adding the dependency in the build.gradle
and adding the require
in the module-info.java
would suffice for the library to be available in order to run the program. I read the Gradle documentation and googled/stackoverflowed, I didn't find a solution for this problem though.