Two maven projects: Find usages of classes in project modules which are not imported

已回答

This is a bit hard to describe so please bear with me.

I have a maven project A which supplies an API and has implementations of this API and modules which use the API (and its implementations). I have project B which only depends on the API and the implementations, but on none of the modules which actually use the API. Whenever I program in project B and want to find out how an API class is usually used I have to switch to project A because in project A none of the modules which use it are imported. That means I need to have both projects open and have to switch all the time. I see an API class in project B, note the name, switch to project B, look the class up and then search for references.

How can I "import" all the other modules from project A in project B so that they aren't actually built or needed when building but so that usages of its classes in project A are shown in the IntelliJ window for project B?

Example:
A has SomeInterface, SomeInterfaceImpl and SomeClassUsingSomeInterface.

B only imports the modules for SomeInterface and SomeInterfaceImpl. I look up usages for SomeInterface and find none. I want to see the usage SomeClassUsingSomeInterface without actually adding its module to project B's dependencies.

Thank you.

0

IDE can not find usages of a class which is used from another IDE project window. You need to have project A and project B combined under the same IDE project. You can add them a Maven modules (from Maven tool window).

0

I  was afraid that's the case. I'm trying to avoid that as it gets confusing really fast. The projects are in different git repositories, I don't want to make any changes to project A by accident Ah well.

0

Consider using scopes and scope colors for different projects.

1

Uhhh, I didn't know of scope colors, that's awesome.

0

请先登录再写评论。