There are 6 scopes:
This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
This is much like
compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope
providedbecause the web container provides those classes. A dependency with this scope is added to the classpath used for compilation and test, but not the runtime classpath. It is not transitive.
This scope indicates that the dependency is not required for compilation, but is for execution. Maven includes a dependency with this scope in the runtime and test classpaths, but not the compile classpath.
This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. This scope is not transitive. Typically this scope is used for test libraries such as JUnit and Mockito. It is also used for non-test libraries such as Apache Commons IO if those libraries are used in unit tests (src/test/java) but not in the model code (src/main/java).
This scope is similar to
providedexcept that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
This scope is only supported on a dependency of type
<dependencyManagement>section. It indicates the dependency is to be replaced with the effective list of dependencies in the specified POM's
<dependencyManagement>section. Since they are replaced, dependencies with a scope of
importdo not actually participate in limiting the transitivity of a dependency.
|compile classpath||test classpath||runtime classpath|