1

我已经下载了 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文件添加到languageIdentificationTika。我已经farsi.ngp通过 Maven 添加并构建了 Tika,但现在我不知道下一步是什么。我真的必须在我的项目中添加什么?

4

1 回答 1

2

我阅读了此页面,以下是我的建议:

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

 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>

希望这对您有所帮助。

于 2012-02-06T17:50:14.030 回答