Link maven dependency sources to sources of an external maven project added as module to main idea project

I am using IDEA 11. I have a project that uses some dependency that is also mine. This dependency is a standalone project, but I would like to have it in the same window as the main project because I would like to easily browse sources, jump to them and edit them as needed. The way I do this is that I choose File -> Add module -> From external model -> Maven and the project gets imported. However, in the main project, when I CTRL+click a class that comes from the maven dependency, the sources that get shown are the ones from the sources jar that get downloaded from maven repository, not the ones that are in the imported module (so I can't edit them, for instance).
I can work around this by going to Project structure of the main project, and in Libraries I look up the maven dependency in question, and change the source to point to the src/main/java folder of the imported module. This is far from perfect as I have to do it manually for each such dependency. This works automatically when dependencies are submodules of the same module project. Can this somehow be also automized for the case I've just described?

Please sign in to leave a comment.