【问题标题】:Module resolution exeption with odfdom and Gradleodfdom 和 Gradle 的模块解析异常
【发布时间】:2022-10-24 04:15:06
【问题描述】:

我正在模块化和现有的非模块化应用程序。为了让 Java 模块系统让我的生活更轻松,我决定选择一个与我的应用程序类似的工作示例https://github.com/beryx-gist/badass-jlink-example-log4j2-javafx,并添加我需要的依赖项并使其工作。我从odfdom 开始,我正在使用jOpenDocument 处理很多OpenDocument 电子表格,但odfdom 现在看起来更有希望,所以我正在转向那个。运行示例时出现以下错误:

java.lang.module.ResolutionException: Modules maven.core and maven.artifact export package org.apache.maven.artifact.repository to module org.json

当我将以下行添加到 buid.gradle 时会发生这种情况:

implementation 'org.odftoolkit:odfdom-java:0.10.0'

否则项目将按预期构建和运行。 我应该如何解决这个问题? 这是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"
}

module-info.java

module hellofx {
    requires javafx.controls;
    requires org.apache.logging.log4j;
    
    exports org.openjfx;
}

【问题讨论】:

    标签: java odfdom


    【解决方案1】:

    我认为您可能需要在 module-info.java 中添加实现“org.odftoolkit:odfdom-java:0.10.0”的模块名称:

    requires odfdom.java;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-04
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 1970-01-01
      • 2013-04-13
      相关资源
      最近更新 更多