If i have the following output from running mvn dependency:tree are the jars that are brought in test or compile scope?
[INFO] | +- io.springfox:springfox-swagger1:jar:2.5.0:test
[INFO] | | +- io.springfox:springfox-schema:jar:2.5.0:compile
[INFO] | | +- io.springfox:springfox-swagger-common:jar:2.5.0:compile
It will be test. But this is not a general rule for all scope pairs. In your case, this holds:
For the
testscope, bothruntimeandcompilescope transitive dependencies will be pulled in with thetestscope, in the project.
More details can be found at https://www.baeldung.com/maven-dependency-scopes
In your example all three dependencies are effectively test scoped. As per Dependency Scope docs any transitive compile scoped dependency of a test scoped dependency becomes test scope:
Each of the scopes (except for import) affects transitive dependencies in different ways, as is demonstrated in the table below. If a dependency is set to the scope in the left column, transitive dependencies of that dependency with the scope across the top row will result in a dependency in the main project with the scope listed at the intersection. If no scope is listed, it means the dependency will be omitted.
compile provided runtime test
compile compile - runtime -
provided provided - provided -
runtime runtime - runtime -
test test - test -
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With