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表示被依赖项目需要参与当前项目的编译,包括后续的测试,运行周期也 ...
随机推荐
- 将Java程序作成exe文件的几种方法【转载】
看到网上有同志的介绍将Java程序作成exe文件的方法,写的不错,但是也许是这篇文章完成的时间比较早,许多内容已经不合适了.我在这里补充几条: 一.exe4j 说明:exe4j可以将Jar文件制作成e ...
- Maven3.2创建webapp项目过程中问题以及解决方案
用maven组件来创建web项目,maven的好处一大堆,但是在创建项目的时候问题也很多,诸多不顺,网上找了很多资料,貌似都没能解决问题. 环境:jdk1.7.0_80,eclipse4.4,mave ...
- Android自己定义DataTimePicker(日期选择器)
Android自己定义DataTimePicker(日期选择器) 笔者有一段时间没有发表关于Android的文章了,关于Android自己定义组件笔者有好几篇想跟大家分享的,后期会记录在博客中.本篇 ...
- UVA 816 - Abbott's Revenge(BFS)
UVA 816 - Abbott's Revenge option=com_onlinejudge&Itemid=8&page=show_problem&category=59 ...
- Java多线程之wait(),notify(),notifyAll()
在多线程的情况下,因为同一进程的多个线程共享同一片存储空间,在带来方便的同一时候,也带来了訪问冲突这个严重的问题.Java语言提供了专门机制以解决这样的冲突,有效避免了同一个数据对象被多个线程同一时候 ...
- 利用 Composer 一步一步构建自己的 PHP 框架(二)——构建路由
本教程示例代码见 https://github.com/johnlui/My-First-Framework-based-on-Composer 上一篇中我们已经建立了一个空的 Composer 项目 ...
- javascript 十六进制与RGB颜色值的相互转换
http://www.zhangxinxu.com/wordpress/?p=646 http://www.zhangxinxu.com/wordpress/?p=646 -------------- ...
- Lexia3 Citroen/Peugeot Diagnostic tool install instruction
We knew that Lexia-3 is a professional Citroen and Peugeot diagnostic interface, it’s both easy-usin ...
- python(6)-shutil模块
高级的 文件.文件夹.压缩包 处理模块 shutil.copyfileobj(fsrc, fdst[, length]) 将文件内容拷贝到另一个文件中: #源码 def copyfileobj(fsr ...
- tomcat部署应用的几种方式
接着上篇 tomcat配置详解,再来学习下如何在tomcat下部署应用 1.部署方式 第一种,最常用,直接把WAR包或者文件夹直接放到webapps目录下面,这时访问路径就是WAR包或者文件夹的名称. ...