0

如何将所有作为依赖项传入的 jar 打印到 Maven 编译器?

-Dmaven.compiler.verbose 

不起作用。

4

2 回答 2

1

$ mvn dependency:tree -Dverbose

示例输出

[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
[INFO] |  \- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] |     \- commons-digester:commons-digester:jar:1.6:compile
[INFO] |        \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)
[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
[INFO]    \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
[INFO]       \- commons-collections:commons-collections:jar:2.0:compile

这里

于 2013-09-05T10:54:08.277 回答
1

这些路径将被 Maven 编译器插件打印为调试日志。用于-X启用调试日志记录,然后过滤掉特定行:

mvn -X test-compile | fgrep 'classpathElements ='

显示:

[DEBUG]   (f) classpathElements = [XXX/target/classes]
[DEBUG]   (f) classpathElements = [XXX/target/test-classes, XXX/target/classes, YY
Y/.m2/repository/junit/junit/4.11/junit-4.11.jar, YYY/.m2/repository/org/hamcres/h
amcrest-core/1.3/hamcrest-core-1.3.jar]

通过管道输出less将显示这些行周围的更多细节。

于 2013-09-07T12:51:12.800 回答