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. <!-- str.startsWith('胡') 检查一个 字符串中是否有某字符 返回true false -->& vh 属性

    1.<!-- str.startsWith('胡')  检查一个 字符串中是否有某字符 返回true false --> 2. vh 分享到选择其它项   复制本页链接 版本:CSS3 补 ...

  2. webserive学习记录6-页面请求webservice

    前面都是通过JAVA代码访问webservice服务,下面将介绍通过javascript,jquery访问webservice服务并介绍过过servlet解决跨域问题的方法. 服务端 编写服务代码,解 ...

  3. @Controller 和 @RestController的区别

    @Controller 和 @RestController的区别 如果只是使用@RestController注解Controller,则Controller中的方法无法返回jsp页面,或者html,配 ...

  4. sessionpage1

    session1 <%@page import="java.text.SimpleDateFormat"%> <%@ page language="ja ...

  5. ArcGIS案例学习笔记3_1

    ArcGIS案例学习笔记3_1 联系方式:谢老师,135_4855_4328,xiexiaokui#139.com 时间:第三天上午 内容1:ArcGIS 平台介绍 体系结构 Arcgis for d ...

  6. python函数式编程(转)

    函数式编程是使用一系列函数去解决问题,按照一般编程思维,面对问题时我们的思考方式是“怎么干”,而函数函数式编程的思考方式是我要“干什么”. 至于函数式编程的特点暂不总结,我们直接拿例子来体会什么是函数 ...

  7. linux 批量删除文件名中有换行符

    ls -i | grep ^M | awk '{print $1}' | xargs -t -I [] find . -inum [] -exec rm -if {} \; 注意^M 是ctrl+v ...

  8. hdoj1043 Eight(逆向BFS+打表+康拓展开)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1043 思路: 由于自己对康拓展开用的太少,看到这个题没想到康拓展开,最开始打算直接转换为数字,但太占内 ...

  9. 转)TNS协议--翻译自《The Oracle Hackers Handbook》

    在开发源工具解决Oracle中的问题时,必须了解TNS协议.在努力理解TNS协议的时候,Oracle JDBC驱动程序(classes12.zip)会是一个很有用的资源TNS头. 每个TNS包都有一个 ...

  10. Ugly number丑数2,超级丑数

    [抄题]: [思维问题]: [一句话思路]:Long.valueOf(2)转换为long型再做 [输入量]:空: 正常情况:特大:特小:程序里处理到的特殊情况:异常情况(不合法不合理的输入): [画图 ...