Post-Compile Checks
Explore how to implement post compile checks to enforce architecture boundaries and dependency rules in your software. Discover tools like ArchUnit that help detect violations at runtime, ensuring layers in hexagonal architecture remain isolated and dependencies flow correctly. Understand the importance and limitations of maintaining these checks alongside your codebase.
We'll cover the following...
As soon as we use the public modifier on a class, the compiler will let any other class use it, even if the direction of the dependency points in the wrong direction according to our architecture.
Since the compiler won’t help us out in these cases, we have to find other means to check that the Dependency Rule isn’t violated.
Implementing post-compile checks
One way is to introduce post-compile checks, i.e., checks that are conducted at runtime, when the code has already been compiled. Such runtime checks are best run ...