Dependency Scope

Dependency scope is used to limit the transitivity of a dependency, and also to affect the classpath used for various build tasks.

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.

15) maven dependency scope的更多相关文章

  1. Maven Dependency Scope用法

    原帖地址:http://uule.iteye.com/blog/2087485 官方API描述 Dependency scope 是用来限制Dependency的作用范围的, 影响maven项目在各个 ...

  2. Maven Dependency Scope

     官方API描述 Dependency scope 是用来限制Dependency的作用范围的, 影响maven项目在各个生命周期时导入的package的状态. 自从2.0.9后,新增了1种,现在有了 ...

  3. Maven的dependency scope属性

    官方地址:https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependen ...

  4. Maven学习----Dependency scope

    首先官网API 2.09版本之后,有6中scope. Dependency scope 用来限制依赖的作用范围,同时也作用于各种编译路径类路径,下面详细说明这六种路径: compile这是默认范围,C ...

  5. Dependency Scope

    Dependency Scope <dependency>中还引入了<scope>,它主要管理依赖的部署.目前<scope>可以使用5个值: * compile,缺 ...

  6. Maven依赖Scope标签用法

    在一个maven项目中,如果存在编译需要而发布不需要的jar包,可以用scope标签,值设为provided.如下: <dependency>            <groupId ...

  7. maven中scope属性的

    Dependency Scope 在POM 4中,<dependency>中还引入了<scope>,它主要管理依赖的部署.目前<scope>可以使用5个值: * c ...

  8. maven中scope

    scope maven中scope的默认值是compilescope的分类1)compile 默认是compile.compile表示被依赖项目需要参与当前项目的编译,包括后续的测试,运行周期也参与其 ...

  9. Maven错误Failed to read artifact descriptor for xxx:jar 和 missing artifact maven dependency

    可参考:http://stackoverflow.com/questions/6111408/maven2-missing-artifact-but-jars-are-in-place http:// ...

随机推荐

  1. How To Pronounce 3-Syllable Phrases

    How To Pronounce 3-Syllable Phrases Share Tweet Share Tagged With: 3-Syllable Learn about the stress ...

  2. Tensorflow从文件读取数据

    http://blog.csdn.net/zengxyuyu/article/details/53289906

  3. spark cache table

    http://www.07net01.com/2015/11/961118.html http://www.cnblogs.com/charlotte77/p/5468968.html 文本读入和写出 ...

  4. spring 在web容器启动时执行初始化方法

    开发框架:spingMVC+myBatis 解决方案:给web容器添加一个Listener类,在容器启动的时候执行Listener的“初始化”方法,在这个初始化方法中执行查询数据库的所有操作,然后将数 ...

  5. At least one JAR was scanned for TLDs yet contained no TLDs.

    Tomcat提示如下: At least one JAR was scanned for TLDs yet contained no TLDs. =========================== ...

  6. 清空表中数据 id从1开始

    删除表的记录以后,如何使新记录的编号仍然从1开始有两种方法: 方法1: truncate table 你的表名 --这样不但将数据删除,而且可以重新置位identity属性的字段. 方法2: dele ...

  7. vc通过webbrowser操作ie元素

    1>需要引用 webbrowser2.h,mshtml.h //m_web绑定的webbrowser的变量 CComQIPtr<IHTMLDocument2,&IID_IHTMLD ...

  8. Spring框架的事务管理的基本概念

    1. 事务:指的是逻辑上一组操作,组成这个事务的各个执行单元,要么一起成功,要么一起失败! 2. 事务的特性 * 原子性 * 一致性 * 隔离性 * 持久性 3. 如果不考虑隔离性,引发安全性问题 * ...

  9. cannot convert from 'wchar_t *' to 'char *' 问题

    MFC中使用unicode 会导致cstring之间的转换变的很复杂 经常遇到这样的错误cannot convert from 'wchar_t *' to 'char *' 强制转换成wchar_t ...

  10. MVC4升级到MVC5未能加载文件或程序集System.Web.WebPages.Razor, Version=3.0.0.0

    首先,我并没有升级他,头一天还是好好的,用的都是2.0.0.0版本的,今天来打开就出现了这个错误: 未能加载文件或程序集“System.Web.WebPages.Razor, Version=3.0. ...