Spring-Modulith is a popular framework to define architectural constraints. Sonargraph is able to generate architecture DSL out of a Spring-Modulith application. To do so either right-cklick on the "Architecture" folder in the "File" tab or select from the "File/New/Architecture" menu. This will show the menu option "New Architecture File Based On Spring-Modulith". Once selected a one page wizard will pop up. There you have to point Sonargraph to the "application-modules.json" file, which is generated when you run tests on a Spring-Modulith application. It is usually found in the "classes/META-INF" directory of the build output. Then you have to type in the name of the architecture DSL file to be generated and also decide, if you want the new file to be added to the architecture check immediately.
Once you have generated the architecture you will enjoy all the benefits of Sonargraph while working with a Spring-Modulith based architecture. You can use this generated architecture as a base for a more fine-grained specification. You can visualize architecture violations using Sonargraph's dependency viewers like the exploration view. And if you use our IDE plugins for Eclipse or IntelliJ you can see violations while coding. You don't have to wait for a build to finish. If you use our SonarQube integration Spring-Modulith based architecture violations will become visible in SonarQube. They will also show up in the architecture metrics provided to Sonargraph-Enterprise.
Certain changes in your code-base will require you to re-generate the architecture DSL:
-
Changes in the number of existing modules.
-
Changes in named interfaces or allowed dependencies between modules.
-
Adding new dependencies between modules that were not there before or rem oving existing dependencies between modules.