Looking at documentation http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html, we can see <scope>
tag under <dependency>
What is that and how can we use it for running test?
.pom
dependency
scope
can contain:
compile
- available at Compile-time and Run-timeprovided
- available at Compile-time. (this dependency should be provided by outer container like OS...)runtime
- available at Run-timetest
- test compilation and run timesystem
- is similar to provided
but exposes <systemPath>path/some.jar</systemPath>
to point on .jar
import
- is available from Maven v2.0.9 for <type>pom</type>
and it should be replaced by effective dependency from this file <dependencyManagement/>
Six Dependency scopes:
src/main
and src/test
src/test
<dependencyManagement/>
, only available in Maven 2.0.9 or later (like java import
)Scope tag is always use to limit the transitive dependencies and availability of the jar at class path level.If we don't provide any scope then the default scope will work i.e. Compile .
If we don't provide any scope then the default scope is compile, If you want to confirm, simply go to Effective pom tab in eclipse editor, it will show you as compile.
Source: Stackoverflow.com