Maven依赖
? ?最近学习maven3.0,对自己的学习关于依赖进行了总结:
?
maven是把编译分成三种classpath,编译classpath、测试classpath、运行classpath。
1、依赖范围:
? ? ?(1)、compile:编译依赖范围,如果没有指定,就会默认使用该依赖范围。该依赖范围在编译、测试、运行三种classpath都是有效的。
? ? ?(2)、test:测试依赖范围,使用次依赖范围maven依赖,只是对测试classpath有效的
? ? ?(3)、provided:以提供依赖范围,使用此依赖范围,对于编译、测试classpath有效,但在运行时是无效的。
? ? ?(4)、tuntime:运行依赖范围,使用此maven依赖范围,对于测试和运行classpath有效,但是在编译是无效的。
? ? ?(5)、system:系统依赖范围,该依赖与三种claspath的关系,和provided完全一致,但是,使用system依赖必须通过systempath显示的指定。
?
示例:
? <dependency>
?<groupId>javax.sql</groupId>
?<artifactId>jdbc-stdext</artifactId>
? <scope>system</scope>
</dependency>
2、依赖具有传递性
?
?
?
?
?
?