My project structure looks like this:
PARENT POM which holds external dependencies [located separately from the project]
MAIN POM, which is a child of PARENT POM, it holds a set of child modules [it is located in root folder of the project]
CHILD MODULES, each of them is a child of MAIN POM, [a set of folders inside the root folder]
I want to create a dependency graph of my project. For this I want to print the dependency data with
mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:tree
-DoutputFile=deps.tgf -DoutputType=tgf -DappendOutput=true
and then open generated file with some editor.
The problem is that my approach works as expected only for simple projects, formed by one POM. For my case it fails.
simple
mvn dependency:tree
works as expected and shows all the dependencies, including the child modules. But when I try to create my dependency tree with outputFile=text
parameter, as I have written above, - it fails. It fetches only the dependencies of the Pom, on which I run the command, i.e. MAIN POM in my case. The child modules are missing!
Is there a way to fix it?
Indeed, it looks like a bug in Maven: mvn dependency:tree
works OK, and mvn dependency:tree -DoutputFile=text
produces logically wrong results.
UPDATE
I have found what happens. It just stores the dependencies file in the child projects! I.e. if I have childProject
which is a module inside MAIN POM - Maven create outputFile.txt
inside this project! And it does not aggregate the files. Not sure I can do something with this apart from writing a script.