maven中plugins和pluginmanagement的区别
stackoverflow中讲的不错
http://stackoverflow.com/questions/10483180/maven-what-is-pluginmanagement
pluginmanagement标签一般用在父pom中,子元素可以包含plugins插件,比如
<pluginManagement><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>2.1</version><configuration><attach>true</attach></configuration><executions><execution><phase>compile</phase><goals><goal>jar</goal></goals></execution></executions></plugin></plugins>
</pluginManagement>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
然后,在子pom文件中就可以这样使用:
<plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId></plugin>
</plugins>
- 1
- 2
- 3
- 4
- 5
- 6
- 1
- 2
- 3
- 4
- 5
- 6
省去了版本、配置等信息,只需指定groupId和artifactId即可。
但是在父pom中,如果使用这个标签来包裹plugins插件,当在此项目根目录运行对应的mvn命令时,如果在子pom中没有直接像上面再次引用这个plugin,那么不会触发这个plugin插件,只有在子pom中再次引用了之后,才会在对应的子项目路径下触发这个plugin.
plugins和pluginManagement标签都需要在build标签中。
这里两者的关系有点类似于dependencyManagement和 dependencies的关系,在dependencyManagement中写的依赖只是声明,并不引入,只有在dependencies中写了,才会真实的引入进来
maven中plugins和pluginmanagement的区别相关推荐
- Maven 中 plugins 和 pluginManagement的区别
plugins 下的 plugin 是真实使用的,而 pluginManagement 下的 plugins 下的 plugin 则仅仅是一种声明,父项目是不能使用的,子项目中可以对 pluginMa ...
- Maven开发笔记(四)—— Maven中plugins和pluginManagement
From: https://www.jianshu.com/p/49acf1246eff 1.plugins和pluginManagement的区别概述 plugins 和 pluginManagem ...
- Maven plugins和pluginManagement的区别概述
plugins 和 pluginManagement 的区别,和我们前面研究过的 dependencies 和 dependencyManagement 的区别是非常类似的.plugins 下的 pl ...
- maven 打包数据库加密_漫画:工作这么多年,你居然不知道 Maven中 Optional 和 Exclusions 的区别?...
Maven 依赖排除(Exclusions) 因为 Maven 构建项目具有依赖可传递的特性,当你在 pom.xml添加某个依赖时,可能也会引入不需要的依赖到你的项目中,这将会会可能引起如下问题: J ...
- Maven中optional和exclusion的区别
用了那么久的Maven,我们都知道Maven的依赖关系具有传递性,比如A依赖B,B依赖C,那么A也依赖于C,具体在项目中的表现见图: 上述依赖在pom.xml中的关系是这样的: C(cc-spring ...
- Maven中dependencies与dependencyManagement的区别
之前在一个开源项目代码中看到有人在maven的依赖中使用 dependencyManagement,由于对这个不是很了解,忽然发现网上有个大神已经写了一个比较好的博客,因此这里直接转载(https:/ ...
- maven 中 dependencies 与 dependencyManagement 的区别
前言 当前的团队工程项目是一个 maven 工程,里面有多模块,包含了父 pom 与子 pom.而在父 pom 中,我见到了 dependencyManagement 这个东西.我们知道一个 mave ...
- Maven中option与exclusion的区别
Optional Dependencies 当无法(无论出于何种原因)将项目拆分为子模块时,将使用option依赖项. 我们的想法是,某些依赖项仅用于项目中的某些功能,如果不使用该功能则不需要. 理想 ...
- IDEA中maven的Plugins报红解决方法
IDEA中maven的Plugins报红解决方法 Idea中maven的Plugins报红解决方法 我的maven项目中plugins下的所有文件都报红,查看报错,这是Maven中plugins没有存 ...
最新文章
- Centos6.8 Mysql 设置自动备份与定期删除备份文件 自测部署安装
- 学习FreeRTOS的几点体会
- python系统关键字_python基础之常用关键字总结
- EnforceLearning:迁移学习-监督训练与非监督训练
- 全国计算机等级考试题库二级C操作题100套(第04套)
- 如何安全使用SWT的显示器asyncExec
- oracle 锁表 and 解锁
- idea2020显示内存占用_【解决讨论】关于macbook pro 16使用 idea2020.1风扇狂转的问题(很吵)...
- 把ICDAR2019-LSVT原始数据集转为REC任务识别数据
- 有没有那种免费的办公软件?
- Hibernate(四)
- 30分钟做一个二维码名片应用,有源码!
- c0604 旋转魔方阵
- webhook是什么_敏锐度调度,Webhook和使整个业务按计划进行
- python是非常依赖于已编译完成的代码吗_初识Python的几点疑惑
- Downloadmanager实现app实现的升级下载使用
- 赵运泓: 12:3下周黄金行情走势分析
- php中下列哪些说法是正确的,关于PHP函数,下列定义方式正确的是
- Intel万兆网卡,intel万兆双口网卡X540T2 性能解剖
- Inventor API:后绑定访问一些Inventor API对象