《Maven实战》笔记 2.2 - dependency scope及其传递性

四个主要的scope:

  1.compile: 编译和运行时都需要

   2.provided: 编译时需要,运行时不用。比如web应用对servlet-api的依赖

   3.runtime:  运行时需要,编译时不用。比如mysql的jdbc driver

   4.test: 顾名思义

scope的传递:

  1. 若A->B是compile,B->C是compile,则A->C也是complile

  2. 若A->B是provided,B->C是provided,则A->C也是provided

  3. 若A->B是provided,B->C是compile,则A->C是provided

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.