The role of scope tags in maven

The scope is used to limit the scope of dependency, affect the state of the package imported by the maven project in each life cycle, and mainly manage the deployment of dependencies.

The scope of scope :

(1) compile: default value , applicable to all stages (indicating that the jar package compile, run and test paths are visible), and will be released along with the project.

(2) Provided: valid during compilation and testing , but this dependency is provided by the server at runtime and will not be included when it is packaged. Such as servlet-api.

(3) Runtime: No need to participate in the compilation of the project , but it needs its participation in the later testing and running cycle. Compared with compile, it skips compilation. Such as JDBC driver, suitable for operation and test phase.

(4) test: only used during testing , used to compile and run test code, will not be released with the project.

(5) system: similar to provided, you need to provide the jar containing the dependency explicitly. It will not be downloaded from the maven repository, but obtained from the local file system. You need to add the attribute of systemPath to define the path.

Published 162 original articles · won 30 · 90,000 views +

Guess you like

Origin blog.csdn.net/ScorpC/article/details/104423450