如何配置Tika的pom.xml以停止获取所有许可证依赖关系警告?

jnb*_*bdz 6 java maven pdfbox apache-tika

尝试使用Tika时,我收到了所有这些警告:

2018年2月24日晚上9:24:35 org.apache.tika.config.InitializableProblemHandler $ 3 handleInitializableProblem警告:未加载JBIG2ImageReader。jbig2文件将被忽略。有关可选依赖项,请参见 https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io。TIFFImageWriter未加载。tiff文件将不会被处理。有关可选依赖项,请参见 https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io。J2KImageReader未加载。JPEG2000文件将不会被处理。请参阅 https://pdfbox.apache.org/2.0/dependencies.html#jai-image-io了解可选的依赖项。

2018年2月24日晚上9:24:35 org.apache.tika.config.InitializableProblemHandler $ 3 handleInitializableProblem警告:org.xerial的sqlite-jdbc未加载。请在您的类路径中提供jar来解析sqlite文件。请参阅tika-parsers / pom.xml以获取正确的版本。

我尝试添加此内容(在Tika pom.xml中):

            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>1.57</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcmail-jdk15on</artifactId>
                <version>1.57</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk15on</artifactId>
                <version>1.57</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>

            <dependency>
                <groupId>com.levigo.jbig2</groupId>
                <artifactId>levigo-jbig2-imageio</artifactId>
                <version>2.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.github.jai-imageio</groupId>
                <artifactId>jai-imageio-core</artifactId>
                <version>1.3.1</version>
                <scope>test</scope>
            </dependency>    
            <dependency>
                <groupId>com.github.jai-imageio</groupId>
                <artifactId>jai-imageio-jpeg2000</artifactId>
                <version>1.3.0</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                    <groupId>org.xerial</groupId>
                    <artifactId>sqlite-jdbc</artifactId>
                    <version>3.20.1</version>
            </dependency>
Run Code Online (Sandbox Code Playgroud)

但是我仍然收到同样的警告。

我该如何解决?

更新1

我的依赖项已添加到此处:https : //github.com/apache/tika/blob/1.17/pom.xml#L164-L170

我也尝试了没有设置测试。它什么也没做。

我添加的依赖项似乎是PDFBox的Tika依赖项。

小智 6

我添加了以下依赖项,但没有其他警告

    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-core</artifactId>
        <version>1.18</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-parsers</artifactId>
        <version>1.18</version>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>jbig2-imageio</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.jai-imageio</groupId>
        <artifactId>jai-imageio-jpeg2000</artifactId>
        <version>1.3.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

  • 注意jai-imageio-jpeg2000有JJ2000许可:“只有“JJ2000合作伙伴”有使用和修改的权利”。 (4认同)

小智 1

很难准确地看到发生了什么,因为您没有包含<dependencies>...</dependencies>pom.xml 的整个部分,但我怀疑这是由于可选的 Maven 依赖项造成的。根据maven 文档,您需要在 pom 中声明可选依赖项,否则它们将不会被加载。

此外,所有 imageio 依赖项都使<scope>test</scope>它们只能在单元测试期间使用。