1. 父级项目POM文件:
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.area19</groupId>
<artifactId>area19-model-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- 设置为 pom 表示该项目为父级项目 取值: jar, war, pom, apk 等-->
<packaging>pom</packaging>
<name>area19-model-parent</name>
<url>http://maven.apache.org</url>
<!-- 引用子级模块 -->
<modules>
<module>upload-model-material</module>
</modules>
<!-- properties 配置, 可以用于管理版本. -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swt.version>1.0</swt.version>
</properties>
<!-- 对项目jar包统一版本管理, 不会引入jar包, 在子模块里不设置版本号将会使用此处设置的版本号 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>brando-commons</groupId>
<artifactId>swt</artifactId>
<version>${swt.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
2. 子级POM配置:
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<!-- 父级项目坐标位置 -->
<parent>
<groupId>cn.area19</groupId>
<artifactId>area19-model-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>upload-model-material</artifactId>
<name>upload-model-material</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- 导入jar包 -->
<dependencies>
<dependency>
<groupId>brando-commons</groupId>
<artifactId>swt</artifactId>
</dependency>
</dependencies>
<!-- 打包成jar 需要使用 java -jar 运行时可使用此插件 -->
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<!-- 配置Main函数位置 -->
<mainClass>cn.area19.MainApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>