Home > Back-end >  List maven dependencies only used during test case run
List maven dependencies only used during test case run

Time:01-27

Can list out the maven dependencies only used during test.

For example: mvn dependency:list

But only ones for test run

CodePudding user response:

mvn dependency:list by default list dependencies with scope test.

This means that you will see dependencies needed for test.
For executing tests you need all your project dependencies.

On list you see scope for each listed dependencies, like:

[VOTE] Release Apache Maven Enforcer version 3.2.0

[INFO] The following files have been resolved:
[INFO]    org.apache.maven:maven-plugin-api:jar:3.2.5:provided
...
[INFO]    org.codehaus.plexus:plexus-utils:jar:3.5.0:compile
...
[INFO]    junit:junit:jar:4.13.2:test

You can include specific dependency scope, or exclude some of them.

  • Related