In my project I have now created several annotation files for third party libraries including Guava, Dagger, slf4j and netty. I have put the annotations in an annotations folder at the root of source control. How can I tell IntelliJ that <project root>/annotations contains third party library annotations and it should always look there (in the appropriate package folder) for third party library annotations? Currently, the only way I know how to deal with this is to try to add an annotation to one of the libraries and then point it at the annotations folder when it prompts. That annotation will then be merged with the existing ones and the entry for annotations will be added to the library.
The problem here is that the IntelliJ project files are not committed to source control, instead they are generated from gradle (./gradlew idea) or from IntelliJ auto-import of build.gradle. This means that anytime someone new clones the repository (or I do a git clean -dfx on my existing clone) I lose the mapping of libraries to their annotations folder.
Ideally, there is something I can add to my gradle file such that when the IntelliJ project is created the annotations are automatically mapped. In lieu of that I would like to only have to do one operation to link up all of the annotations rather than having to go through and manually fix teh annotations for every dependency I have (which can get large for a large project).