惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
博客园 - 【当耐特】
Cyberwarzone
Cyberwarzone
B
Blog
U
Unit 42
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - 叶小钗
F
Full Disclosure
Microsoft Azure Blog
Microsoft Azure Blog
Recorded Future
Recorded Future
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
云风的 BLOG
云风的 BLOG
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
阮一峰的网络日志
阮一峰的网络日志
C
CERT Recently Published Vulnerability Notes
F
Fortinet All Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Cisco Blogs
The Hacker News
The Hacker News
Know Your Adversary
Know Your Adversary
S
Securelist
S
Schneier on Security
P
Privacy International News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
AWS News Blog
AWS News Blog
J
Java Code Geeks
T
The Exploit Database - CXSecurity.com
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
C
Cybersecurity and Infrastructure Security Agency CISA
H
Heimdal Security Blog
博客园 - Franky
P
Palo Alto Networks Blog
PCI Perspectives
PCI Perspectives
T
Tailwind CSS Blog
IT之家
IT之家
Engineering at Meta
Engineering at Meta
Latest news
Latest news
P
Proofpoint News Feed
量子位
Apple Machine Learning Research
Apple Machine Learning Research
K
Kaspersky official blog

博客园 - kingkoo

ReaHat7.6/7.7 最小化安装更新yum源 java程序员经常使用的Intellij Idea插件 NDK版本 下载地址 在Intellij IDEA下用X-debug调试PHP DMSFrame 之查询表达式用法(一) Wise 打包细节 将Centos的yum源更换为国内的阿里云(163)源 Centos下安装 .net Core运行程序 使用 Docker 一步搞定 ZooKeeper 集群的搭建 docker 安装与学习 Centos MySQL数据库迁移详细步骤 Maven 本地仓库明明有jar包,pom文件还是报错解决办法 位与,位或,位异或运算符的理解 编程中位运算用法总结 C++ CompletionPort(完成端口)示例 消息中间件Notify和MetaQ-阿里中间件 DMSFrame 之SqlCacheDependency(二) DMSFrame 之SqlCacheDependency(一) DMSFrame 之简单用法(二)
maven中scope标签以及exclusions 记录
kingkoo · 2018-03-30 · via 博客园 - kingkoo

scope的分类

1.compile:默认值 他表示被依赖项目需要参与当前项目的编译,还有后续的测试,运行周期也参与其中,是一个比较强的依赖。打包的时候通常需要包含进去

2.test:依赖项目仅仅参与测试相关的工作,包括测试代码的编译和执行,不会被打包,例如:junit

3.runtime:表示被依赖项目无需参与项目的编译,不过后期的测试和运行周期需要其参与。与compile相比,跳过了编译而已。例如JDBC驱动,适用运行和测试阶段

4.provided:打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。相当于compile,但是打包阶段做了exclude操作

5.system:从参与度来说,和provided相同,不过被依赖项不会从maven仓库下载,而是从本地文件系统拿。需要添加systemPath的属性来定义路径

scope的依赖传递

A依赖B,B依赖C。当前项目为A,只当B在A项目中的scope,那么c在A中的scope是如何得知呢?

当C是test或者provided时,C直接被丢弃,A不依赖C;(排除传递依赖)

否则A依赖C,C的scope继承与B的scope

exclusions主要用于排除依赖

  1. <exclusions>  
  2.         <exclusion>  
  3.           <groupId>sample.ProjectC</groupId>  
  4.           <artifactId>Project-C</artifactId>  
  5.         </exclusion>  
  6.       </exclusions>   

 当然,对于多重依赖,配置也很简单,参考如下示例:

  1. Project-A  
  2.    -> Project-B  
  3.         -> Project-D   
  4.               -> Project-E <! -- This dependency should be excluded -->  
  5.               -> Project-F  
  6.    -> Project C 

1、maven官网:http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html