Maven: How can I find the module which use a dependency?

Today I've been fighting with the maven support, i.e. I'm really frustrated with it (build 95.24).

I have several modules, all maven based and I see the long list of dependencies in the project view.

It includes several libs, some in different versions.

Now I want to check where the different versions come from. I thought Find usages worked on a lib but it doesn't.

So, how can I find the modules which use a certain library?


Comment actions Permalink

I feel your pain, I started a thread a few weeks ago on the same issue here

Comment actions Permalink

Use the Maven dependency plugin to produce a report, such as:

> mvn dependency:tree

Or if you simply want the discrepancies, use

> mvn dependency:analyze-dep-mgt

Or use the site plugin to produce the dependency reports..

Comment actions Permalink

In addition to the already suggested solutions:

Option 1.
Use Maven dependency graph (I am not sure it is available in the community edition though).
There's no search option there, and you've already filed IDEA-53025 to cover that (which I have already voted for).

Option 2.
In the project tree:
1. Open "External Dependencies"
2. Open "Maven: group:artifact:version" node
3. Select the jar file, press Alt+F1, select in Project Structure.
You end up in another long list of libraries, but from there you can use Alt+F7 to jump to locate the module it's referenced from.

Comment actions Permalink

I've tried Option 2 and it doesn't do anything for me.  I select the Jar and select it in the project structure and nothing changes.  Also, Alt-F7 does nothing from the selected Jar file.

Are you using Idea 9?

Comment actions Permalink

Yes, I am using one of the latest EAP versions (IU-95-24).

You can go straight to Project Structure > Project Settings > Libraries page, then select a "Maven:"-prefixed library and press Alt+F7 (of a "magnifying glass" toolbar button above the library list).

Comment actions Permalink

Ah that I know about, I thought you were talking about doing that from the project view

  Thanks anyway!

Please sign in to leave a comment.