<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>net.biancheng.www</groupId> <artifactId>Root</artifactId> <version>1.0</version> <!--定义的父类pom.xml 打包类型使pom --> <packaging>pom</packaging> <properties> <!-- 定义一些属性 --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <log4j.version>1.2.17</log4j.version> <junit.version>4.9</junit.version> <system.version>1.0</system.version> <mysql.connector.version>5.1.18</mysql.connector.version> <c3p0.version>0.9.1</c3p0.version> </properties> <!--dependencyManagement 标签用于控制子模块的依赖版本等信息 --> <!-- 该标签只用来控制版本,不能将依赖引入 --> <dependencyManagement> <dependencies> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <!--引用的properties标签中定义的属性 --> <version>${log4j.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <!--引用的properties标签中定义的属性 --> <version>${junit.version}</version> <!-- <scope>test</scope> --> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <!--引用的properties标签中定义的属性 --> <version>${mysql.connector.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <!--引用的properties标签中定义的属性 --> <version>${c3p0.version}</version> </dependency> </dependencies> </dependencyManagement> <!--添加需要聚合的模块--> <modules> <module>../App-Core-lib</module> <module>../App-Data-lib</module> <module>../App-UI-WAR</module> </modules> </project>
mvn clean install
图1:Maven 聚合构建
本文链接:http://task.lmcjl.com/news/17997.html