gpt4 book ai didi

java - 如何将 org.apache.tika 源集成到我的项目中?

转载 作者:行者123 更新时间:2023-11-30 04:54:00 25 4
gpt4 key购买 nike

我已经下载了 Apache Tika 源文件夹,并且已经安装了 Maven。然后通过命令行(mvn install)我已经安装了Tika:

[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Apache Tika parent .................................... SUCCESS [4:20.656s]
[INFO] Apache Tika core ...................................... SUCCESS [2:26.466s]
[INFO] Apache Tika parsers ................................... SUCCESS [3:27.711s]
[INFO] Apache Tika application ............................... SUCCESS [1:23.548s]
[INFO] Apache Tika OSGi bundle ............................... SUCCESS [3:34.223s]
[INFO] Apache Tika ........................................... SUCCESS [6.217s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL

但现在我不知道在我的项目中使用 Tika 的下一步是什么。其实我不知道如何在我的项目中添加Tika。

我使用 Tika 源代码而不是 jar 文件的原因是我想将 Farsi.ngp 文件添加到 Tika 的 languageIdentification 中。我已经添加了 Farsi.ngp 并通过 Maven 构建了 Tika,但现在我不知道下一步是什么。我到底必须在我的项目中添加什么?

最佳答案

我读到this页面,以下是我的建议:

修改代码或添加 .ngp 文件并构建代码后,您必须获取这些构建 Artifact :

 tika-core/target/tika-core-1.0.jar
tika-parsers/target/tika-parsers-1.0.jar

无论您希望在应用程序中的何处使用 tika,请将 2 个 tika jar 及其依赖的 jar 添加到类路径中。例如,如果您在应用程序中使用 ant,则将其添加到构建文件中:

<classpath>
... <!-- your other classpath entries -->
<pathelement location="path/to/tika-core-1.0.jar"/>
<pathelement location="path/to/tika-parsers-1.0.jar"/>
<pathelement location="path/to/commons-logging-1.1.1.jar"/>
<pathelement location="path/to/commons-compress-1.0.jar"/>
<pathelement location="path/to/pdfbox-1.0.0-incubating.jar"/>
<pathelement location="path/to/fontbox-1.0.0-incubator.jar"/>
<pathelement location="path/to/jempbox-1.0.0-incubator.jar"/>
<pathelement location="path/to/poi-3.6.jar"/>
<pathelement location="path/to/poi-scratchpad-3.6.jar"/>
<pathelement location="path/to/poi-ooxml-3.6.jar"/>
<pathelement location="path/to/poi-ooxml-schemas-3.6.jar"/>
<pathelement location="path/to/xmlbeans-2.3.0.jar"/>
<pathelement location="path/to/dom4j-1.6.1.jar"/>
<pathelement location="path/to/xml-apis-1.0.b2.jar"/>
<pathelement location="path/to/geronimo-stax-api_1.0_spec-1.0.jar"/>
<pathelement location="path/to/tagsoup-1.2.jar"/>
<pathelement location="path/to/asm-3.1.jar"/>
<pathelement location="path/to/log4j-1.2.14.jar"/>
<pathelement location="path/to/metadata-extractor-2.4.0-beta-1.jar"/>
</classpath>

希望这对您有帮助。

关于java - 如何将 org.apache.tika 源集成到我的项目中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9162373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com