Refactor over multiple projects


I currently have two Intellij projects which each contain multiple modules. Project A uses project B as a library. The projects are maintained in separate git repositories.

I would now like to be able, to have the modules of both projects visible in the same "Project" tool window. Furthermore, changes in project B should be visible in project A.

I was able to successfully "add" project B to project A by importing the pom.xml of project B. I did this under "Project Structure" -> "Modules" -> "Import Module".

BUT: If I refactor (e.g. rename refactoring) a class in project B which is used in project A, project A won't be affected by the refactoring.

Is there a way to accomplish this?

Comment actions Permalink

In case of a Maven project you need a common parent project that will open all the modules inside one project and define the dependencies between them.

Comment actions Permalink

Thanks. The problem was, that I had the dependencies between the modules defined as dependencies on the libraries (jar files) instead of dependencies on modules.


Please sign in to leave a comment.