Reputation: 21134
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.
Upvotes: 4
Views: 1033
Reputation: 21134
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.
Upvotes: 3
Reputation: 1394
You may drag'n'drop the annotations.xml file in the Project pane and move it to the desired location or change the path explicitly in Project Structure | Project Settings | Modules -> module Paths | External Annotations
Upvotes: 0