multi-module-maven
Skill344 starsChanged 3 months agoMITView on GitHub
Use when working in a multi-module Maven project. Covers parent POM conventions, shared dependency management, inter-module rules, build ordering, and Spring Boot 4 modular starter selection.
In this repository77 other files it gives its agents.
- agent-qa-browser-regressionSkill
- ai-observabilitySkill
- api-versioningSkill
- configuration-propertiesSkill
- container-native-deploymentSkill
- domain-driven-designSkill
- event-driven-messagingSkill
- flyway-migrationsSkill
- hateoasSkill
- hexagonal-architectureSkill
- http-interface-clientsSkill
- idempotency-patternsSkill
- java-supply-chain-securitySkill
- layered-architectureSkill
- mcp-serverSkill
- multi-module-mavenSkill
- multi-tenancySkill
- null-safetySkill
- oauth2-resource-serverSkill
- openapi-firstSkill
- problem-details-rfc9457Skill
- production-observabilitySkill
- resilience-retrySkill
- rest-api-conventionsSkill
- security-audit-loggingSkill
- spring-ai-integrationSkill
- spring-ai-securitySkill
- spring-batchSkill
- spring-boot-migrationSkill
- spring-cloud-gatewaySkill
- spring-data-jpaSkill
- spring-data-redisSkill
- spring-incident-responseSkill
- spring-modulithSkill
- spring-security-jwtSkill
- spring-security-reviewSkill
- testing-pyramidSkill
- transactional-patternsSkill
- webflux-reactive-patternsSkill
- agent-qa-browser-regressionSkill
- ai-observabilitySkill
- api-versioningSkill
- configuration-propertiesSkill
- container-native-deploymentSkill
- domain-driven-designSkill
- event-driven-messagingSkill
- flyway-migrationsSkill
- hateoasSkill
- hexagonal-architectureSkill
- http-interface-clientsSkill
- idempotency-patternsSkill
- java-supply-chain-securitySkill
- layered-architectureSkill
- mcp-serverSkill
- multi-tenancySkill
- null-safetySkill
- oauth2-resource-serverSkill
- openapi-firstSkill
- problem-details-rfc9457Skill
- production-observabilitySkill
- The first 60 shown.
The file
Files
Multi-Module Maven
Typical Structure
my-app/
├── pom.xml ← Parent POM (packaging = pom)
├── my-app-domain/ ← Pure Java domain — no Spring
│ └── pom.xml
├── my-app-application/ ← Use cases — depends on domain
│ └── pom.xml
├── my-app-infrastructure/ ← JPA, Redis, HTTP clients
│ └── pom.xml
└── my-app-web/ ← Spring Boot app, REST — depends on all above
└── pom.xmlParent POM
<!-- pom.xml (parent) -->
<project>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>my-app-domain</module>
<module>my-app-application</module>
<module>my-app-infrastructure</module>
<module>my-app-web</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.0</version>
</parent>
<!-- Shared versions — all modules inherit -->
<properties>
<java.version>21</java.version>
<mapstruct.version>1.6.3</mapstruct.version>
</properties>
<!-- Dependency management — centralizes versions, NOT adding to classpath -->
<dependencyManagement>
<dependencies>
<!-- Inter-module dependencies -->
<dependency>
<groupId>com.example</groupId>
<artifactId>my-app-domain</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>my-app-application</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>my-app-infrastructure</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Third-party versions -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Shared plugins -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>Child Module POM (domain — no Spring)
<project>
<parent>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>my-app-domain</artifactId>
<dependencies>
<!-- No Spring. No JPA. Pure Java only. -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>Child Module POM (web — the runnable app)
<project>
<parent>...</parent>
<artifactId>my-app-web</artifactId>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>my-app-application</artifactId>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>my-app-infrastructure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Only in the runnable module, not parent -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>Dependency Rules
| Module | Can depend on | Cannot depend on |
domain | Nothing | Everything |
application | domain | infrastructure, web |
infrastructure | domain, application | web |
web | All modules | — |
Boot 4 Modular Starters
Spring Boot 4 splits the framework into focused modules (spring-boot-<technology>, root
package org.springframework.boot.<technology>). Pick one starter per technology, per module:
- Several starters were renamed:
spring-boot-starter-web→spring-boot-starter-webmvc,spring-boot-starter-oauth2-client→spring-boot-starter-security-oauth2-client(and the other OAuth2 starters gained thesecurity-prefix);spring-boot-starter-data-jpakeeps its name - Starters follow
spring-boot-starter-<technology>; test starters followspring-boot-starter-<technology>-test(no plainspring-boot-starter-testneeded alongside them) - Flyway/Liquibase no longer arrive transitively — add
spring-boot-starter-flyway/spring-boot-starter-liquibasein the module that owns migrations (usuallyinfrastructure) - AOP starter is
spring-boot-starter-aspectj(renamed fromspring-boot-starter-aop) - WAR deploys to external Tomcat use
spring-boot-starter-tomcat-runtime spring-boot-starter-classic/spring-boot-starter-test-classicbundle the old monolithic set — transitional only, don't use in new modules- Optional Maven dependencies are excluded from the repackaged jar by default — set
<includeOptional>true</includeOptional>onspring-boot-maven-pluginif you rely on them
Gotchas
- Agent configures Lombok and MapStruct processors without
lombok-mapstruct-binding— the build then depends on processor order: with MapStruct first, generated mappers miss Lombok's builders/getters and fail to compile; the binding makes it order-independent - Agent puts
spring-boot-maven-pluginin parent POM — only in the runnable module - Agent adds
<dependencies>in parent instead of<dependencyManagement>— adds to all modules' classpath - Agent creates circular dependencies between modules — enforce the dependency direction above
- Agent imports Spring in
domainmodule — domain must be framework-free - Agent uses
${project.version}for inter-module versions — correct, but update parent version to update all - Agent adds
spring-boot-starter-web— renamedspring-boot-starter-webmvcin Boot 4 - Agent adds
spring-boot-starter-aop— renamedspring-boot-starter-aspectjin Boot 4 - Agent adds bare
flyway-core/liquibase-coreexpecting Boot to configure them — usespring-boot-starter-flyway/spring-boot-starter-liquibase - Agent adds
spring-boot-starter-testnext tospring-boot-starter-webmvc-test— the-teststarters are self-contained in Boot 4 - Agent reaches into auto-configuration classes from shared modules — their members are no longer public API in Boot 4
- Agent overrides Boot-managed dependency versions without a compatibility reason - prefer the Boot BOM defaults
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

