Child not finding parent pom in flat structured multi module maven build

跟風遠走 提交于 2019-12-01 17:10:09

Use the <relativePath> element as described in Example 5 of the Introduction to the POM:

<project>
  <parent>
    <groupId>company</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>.../parent/pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>company</groupId>
  <artifactId>child</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>child</name>
  ...
</project>

The parent POM version is 1-0-SNAPSHOT, rather than 1.0-SNAPSHOT.

The child pom does not reference the parent pom, it references another artifact named 'build'. It should read:

<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/maven-v4_0_0.xsd">
    <parent>
        <groupId>company</groupId>
        <artifactId>parent</artifactId>
        <version>1.0-SNAPSHOT</version>
</parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>company</groupId>
<artifactId>child</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>child</name>
(...)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!