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表示被依赖项目需要参与当前项目的编译,包括后续的测试,运行周期也 ...
随机推荐
- fedora 20 注销
当系统只有一个用户和只有一个桌面环境时,Fedora 20将不会显示Log Out菜单. 如果你确实需要logout,可以通过执行gnome-session-quit命令来logout. 如果你确实需 ...
- android140 360 黑名单 启动service和分页加载
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout ...
- online ddl 工具之pt-online-schema-change
MySQL ddl 的问题现状 在运维mysql数据库时,我们总会对数据表进行ddl 变更,修改添加字段或者索引,对于mysql 而已,ddl 显然是一个令所有MySQL dba 诟病的一个功能, ...
- Metadata Lock原理7
http://blog.itpub.net/22664653/viewspace-1791744/ 一 简介 通过前面两篇文章的介绍,相信读到这里的各位对MDL 锁已经有了比较深入的了解了,本文将结合 ...
- Javascript-获取URL请求参数
function getUrlParam(){ var param = [], hash; var url = window.location.href;//获取网页的url va ...
- PHP 正则表达式语法
则表达式简介 在某些应用中,往往有时候需要根据一定的规则来匹配(查找)确认一些字符串,如要求用户输入的 QQ 号码为数字且至少 5 位.用于描述这些规则的工具就是正则表达式. 最简单的匹配 最简单的匹 ...
- Android基本控件之GridView
我们在使用手机的过程中,会看到一些图片配上文字的一些情况,今天我们就来介绍一下安卓控件的GridView GridView组件用来以网格方式排列视图,与矩阵类似,当屏幕上有很多元素(文字.图片或其他元 ...
- python 学习笔记re
在学习python的过程中很多时候都需要用到re(正则),因为我也不是开发所以呢只是简单说一下经常需要用到的东西. 在工作中经常用到的主要是三个函数:1.math 2.search 3.sub ...
- 让 BAT 的 Offer 不再难拿
随着各大公司春招的开始,很多小伙伴都行动起来了,我有幸能够加入百度并和大家分享自己的经验心得.由于我面试的都是比较大的公司,所以自然也是做了这方面的准备,因此这篇总结并不一定适合想去创业公司的同学.另 ...
- python(1) - 列表和元组
列表(list) 列表是经常用到的一种数据类型,是一组有序的数据集合,可以将各种数据有序的存放在列表中,并且可以对其进行增删改查,以及遍历. 列表就是为了使变量能够存储更多的信息,比如我想存储一张购物 ...