MAVEN打包的`parent.relativePath points at wrong local POM`问题
在idea中,利用maven插件时,对于多个maven子项目第一次打包(clear或者install)报错 parent.relativePath points at wrong local POM
经过一番百度操作,发现有两种解决方法,记录一下
1. 可先将下面的模块(modules)注释掉,再进行打包,打包完成后,放开注释,重新打包,就不会报错
(或者把父级pom文件直接拷贝到项目打包路径下也可以(如下代码的com/app/app-interf/1.0-SNAPSHOT目录下))
一些代码
父pom文件
<modelVersion>4.0.0</modelVersion> <groupId>com.app</groupId> <artifactId>app-interf</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.4.RELEASE</version> <relativePath/> </parent> <developers> <developer> </developer> </developers> <modules> <module>jdbc</module> <module>util</module> <module>common</module> </modules>
子pom文件
<modelVersion>4.0.0</modelVersion> <packaging>jar</packaging> <groupId>com.app.jdbc</groupId> <artifactId>jdbc</artifactId> <version>1.0-SNAPSHOT</version> <parent> <artifactId>app-interf</artifactId> <groupId>com.app</groupId> <version>1.0-SNAPSHOT</version> <relativePath/> </parent>
2. 在子pom文件中,配置<relativePath>属性
<modelVersion>4.0.0</modelVersion> <packaging>jar</packaging> <groupId>com.app.jdbc</groupId> <artifactId>jdbc</artifactId> <version>1.0-SNAPSHOT</version> <parent> <artifactId>app-interf</artifactId> <groupId>com.app</groupId> <version>1.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent>
改变就是好事.