Skip to content
Advertisement

Detecting cyclic dependencies with Maven

In my application I’m using an external library (Batik 1.7) that is made up of several modules. The modules have multiple cyclic dependencies between themselves. This doesn’t influence the build, but some tools (e.g. the M2Eclipse Dependency Graph, or the Dependencies report) will not work anymore.

Is there a good way to diagnose what cycles are there, and an easy way to get rid of them?

Update: The problem is with the POMs, as e.g. batik-bridge is dependent on batik-gvt, which is in turn depend upon batik-bridge.

I think I can solve this by excluding some of the dependencies manually, but I’m not sure what to exclude. What I’d like to have is a clear overview of the cycles in the graph.

Advertisement

Answer

Try running this from the command line in the root of your topmost project:

mvn dependency:tree
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement