Search code examples
junitjava-8java-9java-platform-module-systemmodule-info

How to enforce module boundaries in Java <= 8


I want to modularize a monolithic application by using Java modules (introduced by Project Jigsaw).

Unfortunately I'm currently stuck to use Java 8. I would like to build those modules (jar files) anyway, but without the feature of using a module-info.java file for declaring the dependencies and the exported API.

Some weeks ago I stumbled upon an API/framework which allows to define nearly the same things that you can do in a module-info.java file. It could be used in JUnit tests in order to enforce module's not to use the internal's of another module and that module's only can access modules they explicitly depend on.

Of course you do not have any assistence from the compiler or the IDE, but you can enforce the access by JUnit. Unfortunately I do not find the project which provides the API any more.

Can anyone help?

Btw. if there is another good approach beside a unit test, please let me know, too!


Solution

  • https://www.archunit.org/ is what I have been looking for.