我有一个父POM文件和四个子POM文件。子模块无法解析relativePath
../pom.xml
。
错误: Error
项目结构: Project structure
全新安装-X: mvn clean install -X
ParentPom:
<?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 https://maven.apache.org/xsd/maven 4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>filler</groupId>
<artifactId>filler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>filler</name>
<packaging>pom</packaging>
<modules>
<module>account-service</module>
<module>lottery-ticket-service</module>
<module>lottery-service</module>
<module>service-registry</module>
</modules>
ChildPom /彩票门票服务:
<parent>
<groupId>filler</groupId>
<artifactId>filler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>lottery-ticket-service</artifactId
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>13</java.version>
</properties>
ChildPom /彩票服务:
<parent>
<groupId>filler</groupId>
<artifactId>filler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>lottery-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>13</java.version>
</properties>
ChildPom /服务注册表:
<parent>
<groupId>filler</groupId>
<artifactId>filler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>service-registry</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>13</java.version>
</properties>
ChildPom /帐户服务:
<parent>
<groupId>filler</groupId>
<artifactId>filler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>account-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>13</java.version>
</properties>
答案 0 :(得分:0)
默认情况下从子pom.xml删除此标记,它将在父目录
中搜索<relativePath>../pom.xml</relativePath>
答案 1 :(得分:0)
似乎您必须在路径中添加父项目的名称:
<relativePath> ../parentclass/pom.xml </relativePath>