aggregationAndParent/pom.xml
<!--6.继承: 用来实现继承的模块 将别的模块相同的统一放入该模块中进行管理 在别的模块中 直接继承该模块就可以了 --> <!--6.继承: 依赖管理 统一管理 每个模块依赖的jar包 子模块只要继承并配合子模块中的pom.xml配置就可以进行导入相应的依赖jar包 --> <dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> </dependencies> </dependencyManagement>
user-service
<parent> <groupId>org.maven.demo</groupId> <artifactId>user-aggregationAndParent</artifactId> <version>0.0.1-SNAPSHOT</version> <!--6. 继承哪个模块下的pom.xml 比如需要../是user-aggregationAndParent下的pom.xml --> <!-- 继承的绝对路径是pom.xml文件 --> <relativePath>../user-aggregationAndParent/pom.xml</relativePath> </parent>
继承后 在user-service引入方式
<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> </dependencies>