Maven 安装失败,type=pom 依赖

Maven install fails with type=pom dependency

我正在将 Maven 依赖项 tika-parsers 从 v1.14 更新到 v2.4.0。单独改版本导致maven找不到jar:

Could not resolve dependencies for project samm:samm:war:2.0.0: Could not find artifact org.apache.tika:tika-parsers:jar:2.4.0 in central (https://repo.maven.apache.org/maven2)

由于 mvnrepository 报告 v2 现在需要 <type>pom</type>,我在其中添加了它,当 jar 错误消失时,我的代码无法编译,因为它在tika-parses 包。

<dependency>
  <groupId>org.apache.tika</groupId>
  <artifactId>tika-parsers</artifactId>
  <version>2.4.0</version>
  <type>pom</type>
</dependency>

package org.apache.tika.detect does not exist

我已经确认该包应该存在,因为它在 v2 中没有被重命名,它仍然在他们的 API 文档中。听起来 type=pom 应该告诉 maven 下载 their POM 中列出的所有依赖项,但我不知道发生了什么。

我还需要做其他事情吗?

如果您查看链接的 pom,您会发现它列出了 0 个编译时依赖项,并且核心库被列为单元测试范围依赖项。 如果您按照入门,似乎您也应该依赖 tika-core:https://tika.apache.org/2.4.0/gettingstarted.html

试试这个:https://mvnrepository.com/artifact/org.apache.tika/tika-parsers-standard-package/2.4.0. It's not as complete as version 1.x, but there are others in https://mvnrepository.com/artifact/org.apache.tika