(六)Maven 学习之依赖范围

<denpendencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>    //三种classpath:编译 测试 运行
    </dependency>
</denpendencies>    

socpe 属性范围:

compile  默认范围,编译测试运行都有效

providedc 测试和编译有效

runtime    测试和运行时有效

test        测试时有效

system       测试和编译有效,与本机系统关联,可移植性差

import        导入的范围,它只使用在dependencyManagement中,表示从其他pom中导入denpendency配置

原文地址:https://www.cnblogs.com/diaoniwa/p/6428933.html