zoukankan      html  css  js  c++  java
  • Maven使用Scope标签

         <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>javax.servlet.jsp-api</artifactId>
                <version>2.3.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>

    There are 6 scopes available:

    • compile
      默认的scope,表示 dependency 都可以在生命周期中使用。而且,这些dependencies 会传递到依赖的项目中。适用于所有阶段,会随着项目一起发布
    • provided
      跟compile相似,但是表明了dependency 由JDK或者容器提供,例如Servlet AP和一些Java EE APIs。这个scope 只能作用在编译和测试时,同时没有传递性。
    • runtime
      表示dependency不作用在编译时,但会作用在运行和测试时,如JDBC驱动,适用运行和测试阶段。
    • test
      表示dependency作用在测试时,不作用在运行时。 只在测试时使用,用于编译和运行测试代码。不会随项目发布。
    • system
      跟provided 相似,但是在系统中要以外部JAR包的形式提供,maven不会在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.
  • 相关阅读:
    海泉湾
    ns2的wirelessphy中添加定时器
    ns2能量模型添加充电模型
    用gawk和gnuplot来分析ns2的trace文件
    [转载]ns2中的能量模型
    配置本地SVN[转载]
    EMQ插件通过HTTP连接认证服务器实现认证
    在K8S上跑一个helloworld
    EMQ插件组合实现物联网边缘平台的设备通信管理
    在CentOS7上搭建Kubernetes
  • 原文地址:https://www.cnblogs.com/helloquan/p/5752882.html
Copyright © 2011-2022 走看看