maven多模块项目依赖管理

来源:互联网 发布:如何网络编辑 编辑:程序博客网 时间:2024/05/17 01:49

1 项目结构图

Parent`------ childA(BusinessLayer)          `--- pom.xml`------ childB(WebLayer)         `--- pom.xml`------ pom.xml

2 父pom文件

<dependencyManagement>   <dependencies>      <dependency>           <groupId>javax.servlet</groupId>          <artifactId>servlet-api</artifactId>          <version>2.5</version>      </dependency>   </dependencies></dependencyManagement>

3 子pom文件

<dependencies>   <dependency>        <groupId>javax.servlet</groupId>        <artifactId>servlet-api</artifactId>   <!--此处不再需要verison了!-->   </dependency></dependencies>

ps:父pom文件中指定maven依赖jar的version,子pom中不用指定version。这样可以通过parent统一管理maven依赖jar的version。

0 0
原创粉丝点击