I am modulirizing and existing non modular application. To make my life easier with the Java modules system, I decided to pick up a working example https://github.com/beryx-gist/badass-jlink-example-log4j2-javafx which is similar to my app and add the depencies I will need to that and make it work. I started with odfdom
, a I am processing lot of OpenDocument spreadsheets using jOpenDocument
, but odfdom
looks now more promising so I am moving to that. I get the following error when running the example:
java.lang.module.ResolutionException: Modules maven.core and maven.artifact export package org.apache.maven.artifact.repository to module org.json
This occurs when I add the following line to the buid.gradle
:
implementation 'org.odftoolkit:odfdom-java:0.10.0'
otherwise the project builds and runs as expected.
How I am supposed to solve this issue?
Here is the build.gradle
:
plugins {
id 'application'
id 'org.javamodularity.moduleplugin' version '1.8.9'
id 'org.openjfx.javafxplugin' version '0.0.10'
id 'org.beryx.jlink' version "2.24.1"
}
repositories {
mavenCentral()
}
sourceCompatibility = "11"
targetCompatibility = "11"
dependencies {
implementation 'org.apache.logging.log4j:log4j-core:2.11.1' //automatic-module
implementation 'com.google.code.gson:gson:2.9.1' //module
implementation 'org.odftoolkit:odfdom-java:0.10.0' //none
}
javafx {
version = 16
modules = ['javafx.controls']
}
application {
mainClass = "org.openjfx.HelloFX"
mainModule = "hellofx"
}
and the module-info.java
:
module hellofx {
requires javafx.controls;
requires org.apache.logging.log4j;
exports org.openjfx;
}
I think you may need to add to module-info.java the module name for implementation 'org.odftoolkit:odfdom-java:0.10.0':
I am not getting your error but getting lots of other module errors eg
Solution for me was to add some excludes in my build.gradle in order to get it to compile:
My build.gradle is more complex that yours and I seemed to get a lot of module clashes and so it's not the same issue, but I hope this points you in the right direction.