Compile
The package is considered in the build. If there is packaging, dependency is included in the package.
Provided
The package is considered in the build, but is not included in the package if there is packaging.
Import
Only works for dependencies of type POM
in part <dependencyManagement>
of your pom.xml
file. Basically includes all dependencies contained within the POM
pendence of the dependency on your POM
.
Runtime
Indicates that the dependency does not have to be in the build, but needs to be in the execution.
Test
Indicates that the dependency is used only in the testing phase.
System
Similar to provided
, but for JARs. JARs need to be specified explicitly.
More here: link
On what to take into account for each use, this becomes clearer as you bundle your application and some errors appear. For example, the provided
scope is well used when the packages belong to some standard lib
of a specific application server, such as JBoss or WebLogic, where packages do not exist in a Maven repository, but they must be validated at some stage of development.