Skip to content

Invalid sub-module reference from module module3.submodule32 to module module3.submodule31 #787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aribeth007 opened this issue Aug 29, 2024 · 2 comments
Assignees
Labels
in: core Core module meta model type: bug Something isn't working
Milestone

Comments

@aribeth007
Copy link

I was testing a bit spring modulith 1.3.0-M2 and created a project with the following structure

commons
module1
module2
module3

submodule31
submodule32

submodule32 is using Module31Interface like in the example below:
https://github.com/aribeth007/modulith-example/blob/main/src/main/java/com/example/modulith/module3/submodule32/internal/Module32Service.java#L12

submodule32 also has the allowed dependencies specified: https://github.com/aribeth007/modulith-example/blob/main/src/main/java/com/example/modulith/module3/submodule32/package-info.java

While running the Modularity Validation Test I am getting the following exception:
`
org.springframework.modulith.core.Violations: - Invalid sub-module reference from module 'module3.submodule32' to module 'module3.submodule31' (via c.e.m.m.s.internal.Module32Service -> c.e.m.m.s.Module31Interface)!

at org.springframework.modulith.core.Violations.and(Violations.java:119)
at java.base/java.util.stream.ReduceOps$1ReducingSink.accept(ReduceOps.java:80)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1787)
at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:657)
at org.springframework.modulith.core.ApplicationModules.detectViolations(ApplicationModules.java:475)
at org.springframework.modulith.core.ApplicationModules.verify(ApplicationModules.java:440)
at com.example.modulith.ModularityTest.verifiesModularStructure(ModularityTest.java:12)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

`

I was expecting the modularity test to pass. However I am not sure if I am doing anything wrong.

Thank you!

@odrotbohm
Copy link
Member

That's useful feedback and indeed a bug. Investigating.

@odrotbohm odrotbohm self-assigned this Aug 30, 2024
@odrotbohm odrotbohm added the in: core Core module meta model label Aug 30, 2024
@odrotbohm odrotbohm added this to the 1.3 M3 milestone Aug 30, 2024
@odrotbohm odrotbohm added the type: bug Something isn't working label Aug 30, 2024
odrotbohm added a commit that referenced this issue Aug 30, 2024
Previously, we rejected references between sub-modules both contained in the same parent package.

Related ticket: GH-578.
@odrotbohm
Copy link
Member

This is fixed in the latest snapshots. We missed checking for sibling relationships, but that's in place now.

@odrotbohm odrotbohm changed the title Invalid sub-module reference from module 'module3.submodule32' to module 'module3.submodule31' Invalid sub-module reference from module module3.submodule32 to module module3.submodule31 Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Core module meta model type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants