更新:这个问题似乎已经解决了。我仍然可以在源代码的副本上生成它,但它是我删除之前删除的临时副本,然后才意识到我需要它来解决这个问题。我将继续跟踪这一点,看看我是否能找出根本原因。如果没有,我将结束这个问题。
当我从多模块Maven项目的根目录运行mvn dependency:list -DoutputFile=/path/to/file.txt -DappendOutput=true
时,结果输出文件仅包含根pom.xml文件的modules部分中声明的最后一个模块的依赖项。我需要做些什么来使每个子模块的输出附加到输出文件中?
配置: Maven 3.0.3 maven-dependency-plugin 2.6
答案 0 :(得分: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] -------------------------------------------------------------------
我希望这可能有所帮助。
此致
Charlee Ch。