Say I have a set of artifacts (with given groupId/artifactId) which I want to forbid as dependencies for my Maven project. The reason is that these artifacts are not allowed as part of a war
due to some company rule (details don't matter -- it's a legacy problem).
Let me take log4j as an example.
I want to make sure that there is no direct and no transitive dependency on any version of log4j. Now I can go through the dependency tree, find all the positions where log4j is included and try to construct exclusions. As these dependencies may be indirect (transitive) dependencies, these exclusions should probably go to the dependencyManagement section. This seems to be complicated and error-prone.
Is there an easy way to completely exclude a given artifact (or a set of artifacts) as dependency (from the whole project)?