Module dependency for common module #370
Replies: 5 comments 5 replies
-
I'm not sure because I haven't tested it, but @Modulthic::sharedModule seems to write the correct package name. {com.common.enum,com.comm.datatype…} like this. In the case of Java's package, it looks hierarchical to see, but I know it is actually recognized as a separate, independent place. |
Beta Was this translation helpful? Give feedback.
-
tried @Modulithic(sharedModules = "com.common", additionalPackages = "com.common.datatype", useFullyQualifiedModuleNames = true) but it does not work without packge-info. getting org.springframework.modulith.core.Violations: - Module 'com.other' depends on non-exposed type com..common.datatype.testdata within module 'com.common'! |
Beta Was this translation helpful? Give feedback.
-
Also interested…Is it possible in Modulith to "mark" a first-level package as "non module" (and propagate to all sub-packages)? |
Beta Was this translation helpful? Give feedback.
-
Hello, You can do so like this: @org.springframework.modulith.ApplicationModule( Reference: https://docs.spring.io/spring-modulith/reference/fundamentals.html |
Beta Was this translation helpful? Give feedback.
-
I exclude such packages because IMO they shouldn't be modules:
|
Beta Was this translation helpful? Give feedback.
-
I have 3 modules, in this one module name is common.
common
|- datatype
|- infrastructure
|- enums
|- Aggregates
common module has different packages. As this module in common its internal classes of internal packages should be easily accessible.
However using modulith, module. verify fails when I try to use an enum from this common module in any other module.
I can able to resolve this by adding package-info into each subpackage of common module e.g
@org.springframework.modulith.NamedInterface("datatype")
package com.common.datatype;
however, adding package-info into each package is not a clean solution. is there any other way where I could mention this is a shared module so the modularity test should not fail?
Already tried with but it did not work.
@Modulithic(sharedModules = "com.common")
public class Application {
Beta Was this translation helpful? Give feedback.
All reactions