I have a multi module maven project. Some of the modules require dependency D. In order for things to work right, we need compat to come BEFORE D in the class path. (Module D comes from maven central, whereas compat is one of the modules in our multi-module project.) If compat comes after D or is omitted entirely, things seems to work, but actually don't.
Rather than trying to make everyone remember to always pull in both modules, I thought I'd do two things:
- pull in
Das part ofcompat. This helps, but not much. Now people still remember to avoidDand usecompatinstead. But at least the pom.xml file is a bit more concise. - Use the maven enforcer plugin to ban
D. Then if someone forgets, the build fails and they get a reminder.
The problem with part 2 is that the compat module itself needs to import D. So I need to make an exception for it. Any idea how to do that?