微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决将tess4j依赖项添加到pom.xml时,java.lang.module.ResolutionException

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

我怎么知道哪个包装是“有缺陷的”包装?以及如何解决不导出错误文本中命名的程序包的问题?

解决方法

感谢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>

现在似乎正常开始,没有任何错误。也许日志不再起作用了,但是对我来说还可以。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。