Where should Exceptions be put that are used by multiple projects?

exception, java

Solution

Yes you should create it on a separate project, and use it as a dependency on the others. It is not uncommon to see a project/jar that only has the exceptions used in the modules that you work with. It's a fine way to keep things organized IMHO.

Problem

I need to refactor a project with two data models into two separate projects. Both projects use the same Exceptions. Should I create a 3rd project only for these exceptions? Cloning sounds like a no-go.

Original source