I would like to get a list of all dependencies for my maven project but without the test dependencies using Maven 3.6.2.
To list all of the dependencies I've used dependency:tree
or dependency:list
successfully.
I've then tried adding -DincludeScope=compile
and -DexcludeScope=test
as arguments. With these added I still get test dependencies included.
Example command
mvn -f example/location/pom.xml dependency:tree -DincludeScope=compile -DexcludeScope=test
Output
...
...
...
\- junit:junit:jar:4.12:test
\- org.hamcrest:hamcrest-core:jar:1.3:test
Parent dependency is test and child is compile
I've also found another issue. If a parent dependency is test
then I don't want to see any of its dependencies.
...
...
| +- com.google.cloud:google-cloud-core-grpc:jar:1.52.0:test
| | +- com.google.auth:google-auth-library-credentials:jar:0.11.0:compile
How do I remove all test dependencies and their children?
includeScope
and excludeScope
are not a parameters of dependency:tree
Mojo so they will have no effect. Depending on your maven-plugin-dependency
version scope
parameter might work (see MSHARED-4):
mvn dependency:tree -Dscope=compile