scope value | Whether hitting the bag | Explanation |
---|---|---|
compile | Hit the bag | The default scope to compile, expressed as the current dependence involved in the project of compiling, testing and operation phases, are strong dependence. When you package it, it will go hit the bag. |
test | The test relies solely involved in related content, including compilation and execution of test cases, such as qualitative Junit. | |
runtime | Rely solely involved the use of run cycle. Such interfaces are typically implemented library separate libraries, such as libraries JDBC, when compiling the relevant interface dependent only upon the specific operational only require specific MySQL, Oracle, etc. data driver . Such drivers are for runtime libraries. | |
provided | Do not hit the bag | The dependence during packaging, did not need to go, this is provided by the operating environment , such as tomcat or base class library and so on, in fact, it can participate in the dependency cycle compile, test, and operation, and compile equivalent. The difference is that the packing stage exclude operation. |
system | Do not hit the bag | Provided the use of the same, except that the dependency is not extracted from the warehouse maven, but extracted from the local file system , which will be a reference to the attribute extraction systemPath dependent. |
import | This is a version of the maven2.0.9 property, import only be used dependencyManagement and single maven can solve the succession problem, import dependence is not actually involved in the transitive dependencies limit. |
Source: https://blog.csdn.net/blueheart20/article/details/81014116
official address: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope