maven中scope参数说明
There are 6 scopes available:
- compile
This is the default scope, used if none is
specified. Compile dependencies are available in all classpaths of a
project. Furthermore, those dependencies are propagated to dependent
projects. - provided
This is much like compile, but indicates
you expect the JDK or a container to provide the dependency at runtime.
For example, when building a web application for the Java Enterprise
Edition, you would set the dependency on the Servlet API and related
Java EE APIs to scope provided because the web container
provides those classes. This scope is only available on the compilation
and test classpath, and is not transitive. - runtime
This scope indicates that the dependency is not
required for compilation, but is for execution. It is in the runtime and
test classpaths, but not the compile classpath. - test
This scope indicates that the dependency is not
required for normal use of the application, and is only available for
the test compilation and execution phases. - system
This scope is similar to provided except
that you have to provide the JAR which contains it explicitly. The
artifact is always available and is not looked up in a repository. - import (only available in Maven 2.0.9 or later)
This scope is only used on a dependency of type pom in the <dependencyManagement> section. It indicates that the specified POM should be replaced with the dependencies in that POM's <dependencyManagement> section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.
Each of the scopes (except for import) affects transitive
dependencies in different ways, as is demonstrated in the table below.
If a dependency is set to the scope in the left column, transitive
dependencies of that dependency with the scope across the top row will
result in a dependency in the main project with the scope listed at the
intersection. If no scope is listed, it means the dependency will be
omitted.
compile | provided | runtime | test | |
compile | compile(*) | - | runtime | - |
provided | provided | - | provided | - |
runtime | runtime | - | runtime | - |
test | test | - | test | - |
(*) Note: it is intended that this should be runtime scope
instead, so that all compile dependencies must be explicitly listed -
however, there is the case where the library you depend on extends a
class from another library, forcing you to have available at compile
time. For this reason, compile time dependencies remain as compile scope
even when they are transitive.
<scope>,它主要管理依赖的部署。
- compile,缺省值,适用于所有阶段,会随着项目一起发布。
- provided,类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar。
- runtime,只在运行时使用,如JDBC驱动,适用运行和测试阶段。
- test,只在测试时使用,用于编译和运行测试代码。不会随项目发布。
- system,类似provided,需要显式提供包含依赖的jar,Maven不会在Repository中查找它。
maven中scope参数说明的更多相关文章
- maven中scope
scope maven中scope的默认值是compilescope的分类1)compile 默认是compile.compile表示被依赖项目需要参与当前项目的编译,包括后续的测试,运行周期也参与其 ...
- maven中scope标签详解
前言 最近在做itoo的pom优化工作,发现对于maven依赖管理中的scope标签还是有不明白的地方,所以今天就来总结一下这方面的知识,scope在maven的依赖管理中主要负责项目的部署 mave ...
- maven中scope标签以及exclusions 记录
scope的分类 1.compile:默认值 他表示被依赖项目需要参与当前项目的编译,还有后续的测试,运行周期也参与其中,是一个比较强的依赖.打包的时候通常需要包含进去 2.test:依赖项目仅仅参与 ...
- maven中scope标签作用
scope 是用来限制 dependency 的作用范围的,影响 maven 项目在各个生命周期时导入的 package 的状态,主要管理依赖的部署. scope 的作用范围: (1)compile: ...
- maven中scope属性的
Dependency Scope 在POM 4中,<dependency>中还引入了<scope>,它主要管理依赖的部署.目前<scope>可以使用5个值: * c ...
- [转]maven中scope详解
在POM 4中,<dependency>中还引入了<scope>,它主要管理依赖的部署.目前<scope>可以使用5个值: * compile,缺省值,适用于所有阶 ...
- maven中scope标签各个值的意义
在使用maven配置时,有时候会见到scope这个标签,但是总是记不住他们所对应的含义,现在整理一下,以后忘记了再来查看. 版权声明:本文为CSDN博主「MrZhangBaby」的原创文章,遵循 CC ...
- maven中scope属性有哪些
compile,缺省值,适用于所有阶段,会随着项目一起发布. provided,类似compile,期望JDK.容器或使用者会提供这个依赖.如servlet.jar. runtime,只在运行时使用, ...
- 浅谈maven中的scope,systempath
scope maven中scope的默认值是compile scope的分类 1)compile 默认是compile.compile表示被依赖项目需要参与当前项目的编译,包括后续的测试,运行周期也 ...
随机推荐
- Hdu 5568 sequence2 高精度 dp
sequence2 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=556 ...
- SQL SERVER NVARCHAR字段INSERT 中文乱码问题解决
INSERT INTO IPatient ( UID, PatientNo, PatientName, PatientGender, Birthday, BloodType, Country, Nat ...
- 一个简单的小例子让你明白c#中的委托-终于懂了!
模拟主持人发布一个问题,由多个嘉宾来回答这个问题. 分析:从需求中抽出Host (主持人) 类和Guests (嘉宾) 类. 作为问题的发布者,Host不知道问题如何解答.因此它只能发布这个事件,将事 ...
- 【Lucene4.8教程之四】分析
1.基础内容 (1)相关概念 分析(Analysis),在Lucene中指的是将域(Field)文本转换成最主要的索引表示单元--项(Term)的过程.在搜索过程中,这些项用于决定什么样的文档可以匹配 ...
- thrift学习笔记
Thrift学习笔记 一:thrift介绍 Thrift是facebook开发的用来处理各不同系统之间数据通讯的rpc服务框架,后来成为apche的开源项目.thrift支持多种程序语言,包括Java ...
- Jquery 回到顶部
转:http://www.cnblogs.com/DemoLee/archive/2012/04/20/2459082.html 用jQuery实现渐隐渐显的返回顶部效果(附多图) 先来看几个图片 ...
- AVFoundation视频流处理
框架 首先我们从整体对所需框架做个初步了解. AVFoundation在相关框架栈中的的位置: 为了捕捉视频,我们需要这样几种类(与其它的子类). AVCaptureDevice 代表了输入设备,例如 ...
- 你真的会用UITableView嘛
UITableView是工程开发中最经常使用到的UI控件,但是你真的了解它嘛,这里记录几点有用的但你可能并不知道的. 当我们的数据未能显示满一屏幕的时候,UITableView会显示多余的横线,这个时 ...
- BootStrap2学习日记5---列表
常用列表标签有3中如下:<ul><li><ol><li><dl><dt><dd> 例子: <div class ...
- ESX虚拟机文件列表详解
http://jackiechen.blog.51cto.com/196075/210492 关闭状态时的文件列表: *-flat.vmdk:虚拟机的原始磁盘文件,包含整个虚拟机镜像. *.nvr ...