The role of scope tag in Maven

  • compile: Compile dependency range ( default ). The Maven dependency using this dependency scope is valid for the three classpaths of compiling, testing, and running. A typical example is spring-code, which needs to be used when compiling, testing, and running.
  • test: Test dependency range. The Maven dependency that uses this dependency scope is only valid for the test classpath, and this dependency cannot be used when compiling the main code or running the project. A typical example is Jnuit, which is only needed when compiling the test code and running the test
  • provided: The dependent scope has been provided. The Maven dependency that uses this dependency scope is valid for compiling and testing the classpath, but it is invalid at runtime. A typical example is servlet-api, which is required when compiling and testing the project, but when running the project, since the container is already provided, there is no need for Maven to introduce it again and again. The advantage of provided is that the war package is suitable for java -jar command to start and deploy to external container at the same time

Guess you like

Origin blog.csdn.net/sinat_34241861/article/details/115301228