mavendependencies

Create a maven project module tree?


I'm looking for a quick way, for any given multi-module project, to show a quick overview of the project hierarchy including only the modules in the project, excluding external dependencies.

eg for a project

project root
+- A
   +- B
      +- C
   +- D 
      +- E
         +- F
+- G
   +- H

I would like to see a quick, single screen view for A-H (like it is depicted here) that gives me a fast digestible view to get an idea of a project structure. Ideally it would be command line output, not a platform specific solution (I note there is a tool for VisualStudio).

mvn dependency:tree is great but too verbose for this case, I suppose I could grep and cut the output apart but feels like there should be an easier way (ie another plugin).


Solution

  • You can filter the dependency tree: http://maven.apache.org/plugins/maven-dependency-plugin/examples/filtering-the-dependency-tree.html

    So, if your group ID was com.foo.bar, you could get the projects in that group ID with:

    mvn dependency:tree -Dincludes=com.foo.bar
    

    Assuming all of your project's modules are within that group, that would cover your use case.