maven常见错误

  1. 错误如下: ‘packaging’ with value ‘’ is invalid. Aggregator projects require ‘pom’ as packaging. @ line 11, column 16
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging:  @ line 11, column 16
[ERROR] 'packaging' is missing. @ line 11, column 16
[ERROR] 'packaging' with value '' is invalid. Aggregator projects require 'pom' as packaging. @ line 11, column 16
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.atguigu.springcloud:microsevicecloud:0.0.1-SNAPSHOT (/Users/wyshown/Study/microsevicecloud/pom.xml) has 3 errors
[ERROR]     Unknown packaging:  @ line 11, column 16
[ERROR]     'packaging' is missing. @ line 11, column 16
[ERROR]     'packaging' with value '' is invalid. Aggregator projects require 'pom' as packaging. @ line 11, column 16
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

代码如下:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <!--GroupID 是项目组织的唯一标识符,在实际开发中对应JAVA的包的结构,就是main目录里java的目录结构,如 ‘com.atguigu.test’。-->
    <groupId>com.atguigu.springcloud</groupId>
    <!--ArtifactID就是项目的唯一标识符,在实际开发中一般对应项目的名称,就是项目根目录的名称。-->
    <artifactId>microsevicecloud</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
</project>

原因如下:
因为maven工程, 当不设置packaging指定参数的话, packaging的默认值为jar, 而pom的父类工程不能为jar, 所有会出此错误
解决方法,
查看父类的pom文件 是否有pom 如果无则添加pom

2.Non-resolvable parent POM for com.atguigu.springcloud:microsevicecloud-api:1.0-SNAPSHOT: Could not find artifact com.atguigu.springcloud:microsevicecloud:pom:0.0.1-SNAPSHOT and ‘parent.relativePath’ points at wrong local POM @ line 8, column 13

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.atguigu.springcloud:microsevicecloud-api:1.0-SNAPSHOT: Could not find artifact com.atguigu.springcloud:microsevicecloud:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 8, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.atguigu.springcloud:microsevicecloud-api:1.0-SNAPSHOT (/Users/wyshown/Study/microsevicecloud-api/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.atguigu.springcloud:microsevicecloud-api:1.0-SNAPSHOT: Could not find artifact com.atguigu.springcloud:microsevicecloud:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 8, column 13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Process finished with exit code 1

代码如下:

<parent>
    <!--GroupID 是项目组织的唯一标识符,在实际开发中对应JAVA的包的结构,就是main目录里java的目录结构,如 ‘com.atguigu.test’。-->
    <groupId>com.atguigu.springcloud</groupId>
    <!--ArtifactID就是项目的唯一标识符,在实际开发中一般对应项目的名称,就是项目根目录的名称。-->
    <artifactId>microsevicecloud</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

更改后如下:

<parent>
    <!--GroupID 是项目组织的唯一标识符,在实际开发中对应JAVA的包的结构,就是main目录里java的目录结构,如 ‘com.atguigu.test’。-->
    <groupId>com.atguigu.springcloud</groupId>
    <!--ArtifactID就是项目的唯一标识符,在实际开发中一般对应项目的名称,就是项目根目录的名称。-->
    <artifactId>microsevicecloud</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../microsevicecloud/pom.xml</relativePath>
</parent>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值