Issue
There is a multimodule Maven project depending on a "library ABC".
I would like to prevent usage of this library in the project from now on.
It could possibly be used by other dependencies, and that is not a problem --
the goal is ensure the project itself does not depend on it in scopes "compile" and "test".
From the practical perspective, developers should not be able to accidentally import classes from ABC to the project classes. Consider that there are multiple modules, and it is natural that some new dependencies could be added. Still they should not implicitly make the library ABC be available in the project code.
How to configure the build to forbid explicit usage of a particular dependency?
Solution
There are two options:
- maven-dependency-plugin to force developers to specify direct dependencies and maven-enforcer-plugin to ban certain dependencies
- maven-checkstyle-plugin to ban certain imports in java code.
Answered By - Andrey B. Panfilov
Answer Checked By - Katrina (JavaFixing Volunteer)