【问题标题】:java.lang.module.ResolutionException when adding tess4j dependency to pom.xml将 tess4j 依赖项添加到 pom.xml 时出现 java.lang.module.ResolutionException
【发布时间】:2020-08-18 13:43:58
【问题描述】:

当我将 tess4j 添加到我的依赖项时,它会引发以下错误:

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Modules slf4j.simple and logback.classic export package org.slf4j.impl to module xmlgraphics.commons

我了解,有一些依赖项使用与 tess4j 相同的“org.slf4j.impl”。 我的依赖项如下:

<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>14</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>14</version>
    </dependency>

    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-swing</artifactId>
        <version>14</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.11</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
        <version>2.0.20</version>
    </dependency>


    <dependency>
        <groupId>com.company.sap</groupId>
        <artifactId>com.sap.conn.jco.sapjco</artifactId>
        <version>3.1.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/technology.tabula/tabula -->
    <dependency>
        <groupId>technology.tabula</groupId>
        <artifactId>tabula</artifactId>
        <version>1.0.3</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.6</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.7</version>
    </dependency>


    <dependency>
        <groupId>com.onepassion</groupId>
        <artifactId>SDScomXML</artifactId>
        <version>1.0</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>3.1.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>29.0-jre</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j -->
    <dependency>
        <groupId>net.sourceforge.tess4j</groupId>
        <artifactId>tess4j</artifactId>
        <version>4.5.2</version>
    </dependency>


</dependencies>

我怎么知道哪个包是“有问题的”包?以及如何修复它以不导出错误文本中命名的包?

【问题讨论】:

    标签: java maven java-platform-module-system tess4j


    【解决方案1】:

    感谢this Stackoverflow 我解决了这个问题。似乎两个模块 logback-classic 和 slf4j 都来自 tess4j。我只是像这样为他们添加了排除项:

    <!-- https://mvnrepository.com/artifact/net.sourceforge.tess4j/tess4j -->
        <dependency>
            <groupId>net.sourceforge.tess4j</groupId>
            <artifactId>tess4j</artifactId>
            <version>4.5.2</version>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
    
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    

    现在它似乎可以正常启动而没有任何错误。也许日志记录不再起作用,但对我来说没关系。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-27
      • 2013-07-12
      • 2022-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多