Maven 聚合工程的创建( 四 )

common 子工程的 pom.xml<?xml version="1.0" encoding="UTF-8"?><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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>fmmall</artifactId><groupId>com.luis</groupId><version>2.0.1</version></parent><modelVersion>4.0.0</modelVersion><artifactId>common</artifactId><!-- 不指定默认也是 jar --><packaging>jar</packaging></project>beans 子工程的 pom.xml<?xml version="1.0" encoding="UTF-8"?><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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>fmmall</artifactId><groupId>com.luis</groupId><version>2.0.1</version></parent><modelVersion>4.0.0</modelVersion><artifactId>beans</artifactId><!-- 不指定默认也是 jar --><packaging>jar</packaging></project>mapper 子工程的 pom<?xml version="1.0" encoding="UTF-8"?><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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>fmmall</artifactId><groupId>com.luis</groupId><version>2.0.1</version></parent><modelVersion>4.0.0</modelVersion><artifactId>mapper</artifactId><!-- 不指定默认也是 jar --><!--<packaging>jar</packaging>--><dependencies><!-- beans --><dependency><groupId>com.luis</groupId><artifactId>beans</artifactId><version>2.0.1</version></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.47</version></dependency><!-- mybatis--><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.1.4</version></dependency><!-- spring-boot-starter --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId><version>2.4.4</version></dependency><!-- druid --><dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId><version>1.2.9</version></dependency><!-- test --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><version>2.4.4</version></dependency><!-- junit 单元测试--><dependency><groupId>junit</groupId><artifactId>junit</artifactId><scope>test</scope></dependency></dependencies></project>service 子工程的 pom<?xml version="1.0" encoding="UTF-8"?><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 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>fmmall</artifactId><groupId>com.luis</groupId><version>2.0.1</version></parent><modelVersion>4.0.0</modelVersion><artifactId>service</artifactId><!-- 不指定默认也是 jar --><!--<packaging>jar</packaging>--><dependencies><!-- mapper --><dependency><groupId>com.luis</groupId><artifactId>mapper</artifactId><version>2.0.1</version></dependency><!-- common 需要用到 vo,utils,封装数据传参到前端以及工具类 --><dependency><groupId>com.luis</groupId><artifactId>common</artifactId><version>2.0.1</version></dependency></dependencies></project>api 子工程的 pom<?xml version="1.0" encoding="UTF-8"?><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.0https://maven.apache.org/xsd/maven-4.0.0.xsd"><!-- 父工程信息 --><parent><groupId>com.luis</groupId><artifactId>fmmall</artifactId><version>2.0.1</version></parent><modelVersion>4.0.0</modelVersion><artifactId>api</artifactId><!-- 依赖配置 --><dependencies><!-- service --><dependency><groupId>com.luis</groupId><artifactId>service</artifactId><version>2.0.1</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency></dependencies><!--不要将此插件放到顶级父工程中,在需要打成可执行jar的地方添加就好了 , 如果是需要被依赖的,就不要添加此插件--><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>2.3.7.RELEASE</version><configuration><mainClass>com.luis.fmmall.ApiApplication</mainClass></configuration><executions><execution><id>repackage</id><goals><goal>repackage</goal></goals></execution></executions></plugin></plugins></build></project>

推荐阅读