0

更新:这个问题似乎已经解决了。我仍然可以在源代码的副本上生成它,但它是一个临时副本,我在意识到我需要它来解决这个问题之前删除了它。我将继续跟踪这一点,看看我是否能找出根本原因。如果没有,我会关闭这个问题。

当我mvn dependency:list -DoutputFile=/path/to/file.txt -DappendOutput=true从多模块 Maven 项目的根目录运行时,生成的输出文件仅包含在根 pom.xml 文件的模块部分中声明的最后一个模块的依赖项。为了让每个子模块的输出附加到输出文件,我需要做些什么不同的事情吗?

配置:Maven 3.0.3 maven-dependency-plugin 2.6

4

1 回答 1

0

当我使用以下命令时: -

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

结果无效,Maven 告诉我

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

然后我更改以指定版本

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

结果是有效的,Maven 告诉我

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

我建议您确保执行的是2.6 版本。无论如何,我总是使用以下命令作为

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

恕我直言,每个模块的结果更好,更清晰,如下例所示: -

    [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] -------------------------------------------------------------------

我希望这可能会有所帮助。

问候,

查理·Ch。

于 2013-03-01T10:10:02.840 回答