1

I would like to create an aggregate pom for different modules so it can be handled as one big maven project.

ModuleA: web app, has a pom.xml with a parent set to Spring boot

ModuleB: simple java app (not the same dependencies as ModuleA)

Project/
  ModuleA/
    pom.xml  <-- parent is set to spring
  ModuleB/
    pom.xml  <-- no parent
  pom.xml    <-- aggregate pom to create

Here is what I've tried as an aggregate pom:

<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>group</groupId>
    <artifactId>Project</artifactId>
    <version>1</version>
    <packaging>pom</packaging>

    <name>Project</name>

    <modules>
        <module>ModuleA</module>
        <module>ModuleB</module>
    </modules>
</project>

The problem is that when I try to run a maven command on the project level, I get warnings:

[WARNING] Some problems were encountered while building the effective model for group:ModuleA:war:0.0.1
[WARNING] 'parent.relativePath' of POM group:ModuleA:0.0.1 (C:\Project\ModuleA\pom.xml) points at group:Project instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ group:ModuleA:0.0.1, C:\Project\ModuleA\pom.xml

Is this really a problem when I don't want to inherit anything from the aggregate pom?

user
  • 6,567
  • 18
  • 58
  • 85

1 Answers1

1

As explained here and here, unset the relativePath in each project/module pom.xml parent element, since your main project is just there to aggregate the projects (and is not the parent referenced by the modules)

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.6.RELEASE</version>
    <relativePath/>                                      <=========
</parent>
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you. Could you provide a little more information about what happens in this setup when the `relativePath` is **not** unset in the main project? (Some ways this could cause problems in the future, etc.?) – user Mar 31 '19 at 12:45
  • 1
    @user the module is trying to look for the pom of its declared parent in the parent folder: see https://stackoverflow.com/a/45545772/6309. – VonC Mar 31 '19 at 12:46