有什么方法可以排除测试目标期间使用的依赖项?例如,我想避免将所有*:tests
jar 打印为mvn dependency:tree
.
[INFO] Building test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test ---
[INFO] com.test.test:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.13:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.specs2:specs2-core_2.13:jar:4.8.3:test
[INFO] | +- org.specs2:specs2-matcher_2.13:jar:4.8.3:test
[INFO] | +- org.specs2:specs2-common_2.13:jar:4.8.3:test
[INFO] | | +- org.specs2:specs2-fp_2.13:jar:4.8.3:test
[INFO] | | \- org.scala-lang.modules:scala-parser-combinators_2.13:jar:1.1.2:compile
[INFO] | \- org.scala-sbt:test-interface:jar:1.0:test
[INFO] +- org.scalatest:scalatest_2.13:jar:3.1.0:test
[INFO] | +- org.scalactic:scalactic_2.13:jar:3.1.0:test
[INFO] | +- org.scala-lang:scala-reflect:jar:2.13.1:test
[INFO] \- com.fasterxml.jackson.core:jackson-databind:jar:2.10.2:compile
许多 jar 在编译阶段使用,而其他 jar 在测试阶段使用。我正在寻找:
mvn dependency:tree -Dexcludes=org.apache.maven*
所以我想知道是否可以*tests
通过命令行直接排除所有内容。