How do you change class source location for a given class in the context of the IDE?

I have a class that appears as undefined in the IDEA ide. So I used Alt-Enter and accidentally chose the wrong path/location for the class. How do I change this to point/refer to a different path?

This is IDEA 12, btw.



File -> Project Structure
then find the library that contains the class either under "Libraries" or "Global Libraries", select the library, remove the "Sources" entry on the right and add the sources again.
Screenshot - 04.03.2013 , 22_07_41.png


Thanks for the help. I have another question.

I have a source tree. Within it are multiple maven projects. For the sake of efficiency, the main tree does not build all the individual maven projects. These sibling maven projects, therefore, in terms of building are ignorant of each other.

So when I open one of these maven projects under IDEA, it recognizes that project. However, it understandably doesn't know about the other sibling maven projects. Yet I would like my current project to be able to resolve/find sources/breakpoint these other projects. I tried Attach source as the entire tree...and that caused a massive problem which I'm still stuck in, where now my current project's sources are screwed up. I can no longer resolve classes within my own project anymore!

So for example I have the following folder structure:


package foo;

class A extends B {  //<--getting unresolved symbol on B! How is this possible? They are in the same package and folder.
package foo;
class B {


I have no idea anout maven. Formerly was using ant, now switched to gradle.

Anyway let's not hijack a thread with an unrelated topic. Better start a new thread with a good title.


In Maven, if you want your current project to be able to resolve/find sources/breakpoint these other projects,
You should add a dependency of other project to you current project.


You have to add the sibling maven project to current project as a module.


Please sign in to leave a comment.