Maven: Failed to read artifact descriptor

时间:2024-03-30 20:49:50

前提

首先我们引入了第三方的jar,在pom.xml里面配置一下相关的依赖,并刷新maven:
<dependency>
    <groupId>sdk</groupId>
    <artifactId>client</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

现象一:

failed to read artifact descriptor for 

Maven: Failed to read artifact descriptor

现象二:

Could not find artifact sdk:sdk:pom:0.0.1-SNAPSHOT in nexus2(找不到另外一个jar)

Maven: Failed to read artifact descriptor

根因分析:


查看这个jar的pom.xml:
   <parent>
        <artifactId>sdk</artifactId>
        <groupId>sdk</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>client</artifactId>
发现这个jar还引用了父项目的POM,但在maven仓库里面没有父项目对应的jar。解决方法很简单,把
<groupId>sdk</groupId>
<version>0.0.1-SNAPSHOT</version>
移到外层,然后删掉<parent>节点在deploy一下。