如何将所有作为依赖项传入的 jar 打印到 Maven 编译器?
-Dmaven.compiler.verbose
不起作用。
$ 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
看这里
这些路径将被 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
将显示这些行周围的更多细节。