Maven 依赖项在中央存储库中没有 jar,并且由于没有工件,maven 构建失败

Ale*_*lay 2 java eclipse maven

我将此依赖项添加到我的 pom.xml 中。当我构建项目时,如果会产生此错误。

<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-sandbox-parent</artifactId>
  <version>10</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

无法在项目核心上执行目标:无法解析项目 com.name:core:jar:0.0.1-SNAPSHOT 的依赖项:无法在中心找到工件 org.apache.commons:commons-sandbox-parent:jar:10 ( http://repo1.maven.org/maven2 ) -> [帮助 1]

当我按照此链接访问中央存储库时,我注意到该文件夹​​中没有预编译的 jar 文件。构建过程抱怨没有 jar。我使用的所有其他依赖项中都有预编译的 jar 文件。我该如何解决这个问题并编译我的项目?

http://central.maven.org/maven2/org/apache/commons/commons-sandbox-parent/10/

mou*_*mou 5

此依赖项的类型为“pom”,而不是“jar”类型。它在http://central.maven.org/maven2/org/apache/commons/commons-sandbox-parent/10/commons-sandbox-parent-10.pom的 pom 文件中的“打包”标签中提到。

如果在声明依赖项时未指定类型,则假定它是“jar”。您可以改为指定类型“pom”。

<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-sandbox-parent</artifactId>
  <version>10</version>
  <type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)