java.lang.module.resolutionexception将tess4j依赖项添加到pom.xml时

gg0vcinb  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(718)

当我将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>

我怎么知道哪个包裹是“有问题”的?我该如何修复它以不导出errortext中指定的包?

2cmtqfgy

2cmtqfgy1#

多亏了这个堆垛机,我解决了这个问题。似乎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>

现在它似乎开始正常,没有任何错误。也许日志不再工作了,但这对我来说没关系。

相关问题