Search code examples
mavenpom.xml

How to list the Maven build/compilation sequence based on dependencies?


If I have a pom hierarchy in which the superpom calls multiple submodules which depend on one another, how can I list the build/compilation sequence based on dependencies? IOW, if the superpom has modules mod1, mod2, and mod3 and mod2 depends on mod3 and mod3 depends on mod1, then the sequence is mod1, mod3, then mod2. How can I list that order without complex XML parsing of data hierarchies from pom?


Solution

  • Perhaps you're looking for the Maven dependency:tree option? You'll probably have to adjust the includes to include only your modules. http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html

    mvn dependency:tree -Dverbose -DoutputFile=tree.txt -DoutputType=text -Dincludes=com.mycompany.*