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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章