0

UPDATE: This issue seems to have resolved itself. I could still produce it on a copy of the source code, but it was a temporary copy that I deleted before realizing I would need it to pin this issue down. I'm continuing to track this and see if I can identify a root cause. If not, I will close the issue.

When I run mvn dependency:list -DoutputFile=/path/to/file.txt -DappendOutput=true from the root directory of a multi-module Maven project, the resultant output file only contains the dependencies of the last module declared in the modules section of the root pom.xml file. Is there something different I need to do to get the output of each submodule to append to the output file?

Configuration: Maven 3.0.3 maven-dependency-plugin 2.6

Adam
  • 1,011
  • 2
  • 19
  • 37

1 Answers1

1

When I'm using the following command: -

mvn dependency:list -DoutputFile=/path/to/file.txt -DappendOutput=true

The result is invalid and the Maven told me that

[INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ ...

Then I change to specify the version

mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:list -DoutputFile=/path/to/file.txt -DappendOutput=true

The result is valid and the Maven told me that

[INFO] --- maven-dependency-plugin:2.6:list (default-cli) @ ...

I would suggest you to ensure that the executing is the version 2.6. Anyhow I always use the following command as

mvn dependency:list > /path/to/file.txt

IMHO the result is better and more clear for each module as the following example: -

    [INFO] Scanning for projects...
    [INFO] -------------------------------------------------------------------
    [INFO] Reactor Build Order:
    [INFO] 
    [INFO] my-parent
    [INFO] my-sub1
    [INFO] my-sub2
    [INFO]
    [INFO] -------------------------------------------------------------------
    [INFO] Building my-parent
    [INFO] -------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ my-parent  ---
    [INFO] 
    [INFO] The following files have been resolved:
            ...
    [INFO] -------------------------------------------------------------------
    [INFO] Building my-sub1
    [INFO] -------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ my-sub1   ---
    [INFO] 
    [INFO] The following files have been resolved:
            ...
    [INFO] -------------------------------------------------------------------
    [INFO] Building my-sub2
    [INFO] -------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-dependency-plugin:2.1:list (default-cli) @ my-sub2    ---
    [INFO] 
    [INFO] The following files have been resolved:
            ...
    [INFO] 
    [INFO] -------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] my-parent ........................................ SUCCESS [0.745s]
    [INFO] my-sub1 .......................................... SUCCESS [0.675s]
    [INFO] my-sub2 .......................................... SUCCESS [0.671s]
    [INFO] -------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] -------------------------------------------------------------------
    [INFO] Total time: 2.938s
    [INFO] Finished at: Fri Mar 01 17:01:39 ICT 2013
    [INFO] Final Memory: 17M/218M
    [INFO] -------------------------------------------------------------------

I hope this may help.

Regards,

Charlee Ch.

Charlee Chitsuk
  • 8,847
  • 2
  • 56
  • 71
  • Thanks Charlee. I verified that I am indeed using maven-dependency-plugin 2.6 and that I'm only getting the dependencies of the last module processed by the dependency plugin (in other words, it appears to be overwriting the output file rather than appending to it). Yes, forwarding the output to a file is a good option in some use cases. In this case, I just need a list of dependencies for the entire project without respect to which modules are depending on them and without the surrounding Maven log output. – Adam Mar 04 '13 at 16:25
  • Thanks Charlee this worked - mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:tree -DappendOutput=true -Dverbose -DoutputFile=c:\users\xxx\Adhoc\beforeaddition.txt -Djavax.net.ssl.trustStore=C:\Users\xxx\Certs\java.cacerts – DeepaGanesh Jun 08 '22 at 13:15