The role of Scope in maven dependencies


The role of Scope in maven dependencies

Dependency Scope

In POM 4, <scope> is also introduced in <dependency>, which mainly manages the deployment of dependencies. Currently <scope> can use 5 values:

    * compile, the default value, applicable to all stages, will be released with the project.
    * provided, similar to compile, expects JDK, container or user to provide this dependency. Such as servlet.jar.
    * runtime, only used at runtime, such as JDBC driver, suitable for running and testing phases.
    * test, used only when testing, for compiling and running test code. Not released with the project.
    *system, like provided, needs to explicitly provide the jar containing the dependencies, Maven won't look it up in the Repository.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326178156&siteId=291194637