user
user

Reputation: 6797

Create aggregate POM for different projects

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?

Upvotes: 1

Views: 423

Answers (1)

VonC
VonC

Reputation: 1327584

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>

Upvotes: 1

Related Questions