Invalid packaging for parent POM com.cloud:springcloud_demo:1.0-SNAPSHOT, must be “pom“ but is “jar“

2022-06-09 15:13:43 浏览数 (1)

Invalid packaging for parent POM com.cloud:springcloud_demo:1.0-SNAPSHOT, must be “pom“ but is “jar“

子项目用maven打包的时候报错,

解决方法:父项目springcloud_demo的pom.xml指定打包方式:pom

代码语言:javascript复制
<?xml version="1.0" encoding="UTF-8"?>
<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>com.cloud</groupId>
    <artifactId>springcloud_demo</artifactId>
    <version>1.0-SNAPSHOT</version>
 
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
    </parent>
 
    <packaging>pom</packaging>
 
</project>

PS:子项目打包前,父项目要先打包否则会报错:

Could not find artifact com.cloud:springcloud_demo:pom:1.0-SNA

一定要去掉每一个bug和警告,不起眼的警告才折腾几天!!!

0 人点赞