如果我知道导入级别路径,如何找到要放入库的 pom.xml 的工件 ID

How to find artifact id to put in pom.xml of a library if I know the import level path

我开始研究 Java 项目,因此相当新。我想导入一个名为 import com.netflix.iceberg 的包。这里是它的文档:https://netflix.github.io/iceberg/current/javadoc/

所以我需要将这个包放在 pom.xml 内的依赖标签中才能安装它。您如何找到此包或任何后续包的 artifactId。

有一个Central Maven Repository,你可以使用这个page >>

搜索它

在您的特定情况下,您可以尝试使用关键字 icebergnetflix 进行搜索,但它不会为您提供所需的结果,因为 iceberg-api.jar没有出现在中央仓库中。


从您添加的URL:https://netflix.github.io/iceberg/current/javadoc/ it is simple to find the project root, it will be: https://github.com/netflix/iceberg

这里可以看出项目是基于Gradle的。因此,作为一种解决方法,您可以构建所需的 jar 并使用嵌入式 Maven 存储库将其添加到您的项目中,例如如图所示 here >>


要构建 jar,请按照以下步骤操作:

  1. 在此处下载已发布的项目结构:https://github.com/Netflix/iceberg/releases

    目前只有一个版本0.2.0

  2. 由于使用了Gradle Wrapper,最简单的做法是从项目根目录运行:

    ./gradlew tasks

    因为 ./gradlew 是一个 shell 脚本,如果使用 Windows OS 你将需要使用 Cygwin 或类似的东西。

    作为此命令的结果,您将看到所有 Gradle 任务可用于 iceberg 项目。

  3. 我们需要的是assemble,所以只需运行:

    ./gradlew assemble

    作为此命令的结果,将构建 7 个 jar:iceberg-api-0.2.0.jariceberg- common-0.2.0.jar, iceberg-core-0.2.0.jar, iceberg-orc-0.2.0.jar, iceberg-parquet-0.2.0.jar, iceberg-spark-0.2.0.jar, iceberg-运行time-0.2.0.jar.

    iceberg-api-0.2.0.jar位于PROJECT_ROOT\api\build\libs目录.