Maven Dependency and delivery

Source: Internet
Author: User

Compile (compilation scope)

Compile is the default scope, and if a scope is not provided, the scope of the dependency is the compilation scope. Compilation scope dependencies are available in all classpath, and they are also packaged.

Only compile will pass.

provided (range provided)

Provided dependencies are only used when the JDK or a container has provided the dependency. For example, if you develop a Web application, you might need the Servlet API available in the compilation Classpath to compile a servlet, but you don't want to include the Servlet API in the packaged war, and this servlet API JAR is made by your Provided by the application server or the servlet container. A dependency that has been provided for scope is available at compile classpath (not at runtime). They are not transitive and will not be packaged.

Runtime (run-time range)

Runtime relies on the need to run and test the system, but it is not required at compile time. For example, you might need only the JDBC API JAR when compiling, but only if you need JDBC at runtime
Drive implementation.

Test (Test Range)

Test range dependencies are not required for general compilation and runtime, and they are available only during the test compilation and test run phases.

system (System-wide)

Dependency delivery

A: A relies on b1.0 C to rely on b2.0 D to rely on A and C, which one to write first depends on which

Second: Rely on the shortest path principle

Exclude dependencies

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>2.5.6</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>

Maven Dependency and delivery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.