1、最终效果
2、依赖关系
netDisc-web依赖netDisc-common、netDisc-core、netDisc-enetity、netDisc-util。 netDisc-core依赖netDisc-common、netDisc-entity、netDisc-util netDisc-common依赖netDisc-entity、netDisc-util
3、创建过程
1、创建父工程
file → new Project → Maven 一路next
2、创建子工程
在父工作上右击 new - module -maven 一路next
3、添加工程之间的依赖
3.1 父工程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">
<modelVersion>4.0.0
</modelVersion>
<groupId>org.example
</groupId>
<artifactId>netDisc
</artifactId>
<version>1.0-SNAPSHOT
</version>
<packaging>pom
</packaging>
<modules>
<module>netDisc-core
</module>
<module>netDisc-common
</module>
<module>netDisc-util
</module>
<module>netDisc-entity
</module>
<module>netDisc-web
</module>
</modules>
<properties>
<netDisc.version>4.3.20.RELEASE
</netDisc.version>
<netDiscsecurity.version>4.2.10.RELEASE
</netDiscsecurity.version>
</properties>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
</project>
3.2 子工程 以netDisc-core 为例(注意打包方式以效果图中标注的打包方式为准)
<?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>netDisc
</artifactId>
<groupId>org.example
</groupId>
<version>1.0-SNAPSHOT
</version>
</parent>
<modelVersion>4.0.0
</modelVersion>
<packaging>jar
</packaging>
<artifactId>netDisc-core
</artifactId>
<dependencies>
<dependency>
<groupId>org.example
</groupId>
<artifactId>netDisc-common
</artifactId>
<version>1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>org.example
</groupId>
<artifactId>netDisc-entity
</artifactId>
<version>1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>org.example
</groupId>
<artifactId>netDisc-util
</artifactId>
<version>1.0-SNAPSHOT
</version>
</dependency>
</dependencies>
</project>
其他子工程这里就不写了,和上面例子中的子工程大同小异,需要哪个添加哪个包到pom.xml即可