Reputation: 733
is there any way to exclude dependencies used during test goal?
For example I would like to avoid having all *:tests
jar printed by 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
Many jars are used during the compile phase while others during test phase. I was looking to the:
mvn dependency:tree -Dexcludes=org.apache.maven*
so I was wondering if it is possible to directly exclude all *tests
via the command line.
Upvotes: 7
Views: 4475
Reputation: 97359
You can add the scope
like this:
mvn dependency:tree -Dscope=compile
Upvotes: 20