maven多项目配置

来源:互联网 发布:linux操作系统教程 编辑:程序博客网 时间:2024/05/18 04:04

maven多模块项目时,子模块能够继承父模块的pom配置,如果想要子模块有选择性的继承父模块的pom依赖,可以将父模块的依赖配置放置在下面元素中

<dependencyManagement></dependencyManagement>

例如下面的例子

父模块配置:

<dependencyManagement><dependencies><!-- 打日志使用 --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.16</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.7.2</version></dependency></dependencies></dependencyManagement>


子模块选择性集成依赖配置:

<dependencies><!-- 打日志使用 --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></dependency></dependencies>


1 0
原创粉丝点击