I am playing with maven multi module spring boot (v2.1) projects and thought I would be super clever and nest modules within other modules. The purpose of this project is to run different reports, and in the data section I wanted to split the reports by type for manageability, also to share some functionality wike writers, and base classes, as they will be used in every report
below is a screen cap of the hierarchy, but basically, i have a parent pom using (skipping the dependency and build sections):
<packaging>pom</packaging>
<modules>
<module>adhoc-web</module>
<module>adhoc-data</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
the children of the parent pom are a web project and a data project. the data pom looks like (skipping the dependency and build sections):
<parent>
<artifactId>ad-hoc-parent</artifactId>
<groupId>com.recondo.reporting</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>adhoc-data</artifactId>
<packaging>pom</packaging>
<modules>
<module>adhoc-data-base-models</module>
</modules>
<properties>
<java.version>1.8</java.version>
<spring.boot.repackage.skip>true</spring.boot.repackage.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.recondo.reporting</groupId>
<artifactId>adhoc-data-base-models</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<spring.boot.repackage.skip>true</spring.boot.repackage.skip>
</properties>
under the data module what i wanted to do is create sub-modules to organize code. here is an example of a module i created for storing base models that each report could extend from:
<parent>
<artifactId>adhoc-data</artifactId>
<groupId>com.recondo.reporting</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>adhoc-data-base-models</artifactId>
<properties>
<java.version>1.8</java.version>
<spring.boot.repackage.skip>true</spring.boot.repackage.skip>
</properties>
when i try and build this project i get an error that there is a cyclical dependency between adhoc-data-base-model and adhock-data
The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='com.recondo.reporting:adhoc-data:0.0.1-SNAPSHOT'}' and 'Vertex{label='com.recondo.reporting:adhoc-data-base-models:0.0.1-SNAPSHOT'}' introduces to cycle in the graph com.recondo.reporting:adhoc-data-base-models:0.0.1-SNAPSHOT --> com.recondo.reporting:adhoc-data:0.0.1-SNAPSHOT --> com.recondo.reporting:adhoc-data-base-models:0.0.1-SNAPSHOT -> [Help 1]
which i read in possible solution which made sense, but when i removed the dependency in the adhoc-data pom as the link suggests, i get this error:
[ERROR] Failed to execute goal on project ad-hoc-web: Could not resolve dependencies for project com.recondo.reporting:ad-hoc-web:jar:0.0.1-SNAPSHOT: Could not find artifact com.recondo.reporting:adhoc-data:jar:0.0.1-SNAPSHOT -> [Help 1] which makes sense maybe... i am packaging the data module as a pom because that's how the parent module was packaged with child modules....
how should i solve this/ construct multi module maven projects to handle more than one level of dependencies?