spring-projects / spring-projects/spring-modulith
Allow nested packages for @Modulith(sharedModules)
@odrotbohm is already working on this.
Since Mar 8, 2024.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
Current Behavior
The sharedModules parameter of the @Modulith annotation does not allow nested packages, even when the nested packages are explicitly listed.
package structure - com.app.core.exception
@Modulith(sharedModules={"com.app.core"}, useFullyQualifiedModuleNames = true) and @Modulith(sharedModules={"com.app.core", "com.app.core.exception"}, useFullyQualifiedModuleNames = true) result in java.lang.IllegalArgumentException: Module com.app.core.exception does not exist!
@Modulith(sharedModules={"com.app.core"}, additionalPackages = { "com.app.core.exception"}, useFullyQualifiedModuleNames = true) results in
Module 'com.app.user' depends on non-exposed type com.app.core.exception.EntityNotFoundException within module 'com.app.core'!
Desired Behavior
Allow for wildcard(1) or explicitly listed(2) sub-packages to be referenced within all modules.
1 @Modulith(sharedModules={"com.app.core.*"}, useFullyQualifiedModuleNames = true)
2 @Modulith(sharedModules={"com.app.core", "com.app.core.exception"}, useFullyQualifiedModuleNames = true)
Workaround
change package structure to com.app.core and com.app.exception with @Modulith(sharedModules={"com.app.core", "com.app.exception"}, useFullyQualifiedModuleNames = true)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.