IntelliJ IDEA lets you add external annotations.
However, the files go straight into the project's root directory.
How do I change the folder?
I can't find a setting.
This behavior is extremely confusing, and took me a long IDEA debug session to understand.
Let's say we start with a clean situation, and we add an external Annotation to a method of a library.
A popup appears, letting us choose the external Annotations root directory.
And we choose untitled3
, the project's root directory. But ops, we made a mistake!
Now how can we change this directory? Where is it stored?
Well, actually not under any $projectRoot$/.idea/*
XML file...
Let's debug IDEA. The "call" hierarchy is:
> AnnotateIntentionAction
> AddAnnotationPsiFix#invoke
> ExternalAnnotationsManagerImpl#annotateExternally
The last method annotateExternally
calls AnnotationOrderRootType.getFiles(entry)
, where entry
is a LibraryOrderEntry
.
Here orderEntry.getRootFiles(getInstance())
gets called and the resulting VirtualFile
(s) are used as library's external Annotations roots.
Where are they stored?
> Project structure
> Modules
> *your main module*
> Paths
> External Annotations <DELETE HERE>
> Project structure
> Modules
> *your main module with dependencies*
> *your library*
> DOUBLE LEFT CLICK
Now press CANC
over the Annotations entry.
And you're done... Finally. You can restart over.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With