Skip to content

Module dependency for common module #366

Description

@shreyy1234

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 {

Activity

  1. onjik commented on Nov 10, 2023

    @onjik

    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.
    I haven't tested it, so try it.

  2. shreyy1234 commented on Nov 10, 2023

    @shreyy1234
    Author

    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'!

  3. locked and limited conversation to collaborators on Nov 14, 2023
  4. converted this issue into a discussion #370 on Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions