项目中有A
、B
、C
、D
、E
这五个项目,
其中A
打算作为其余四个项目的父模块,用来管理依赖,其余的四个项目打算都是用spring-boot
来开发,请问这个依赖关系我如何在pom.xml
中去定义?
我说一下我目前的方案
A:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<modules>
<module>../B</module>
<module>../C</module>
<module>../D</module>
<module>../E</module>
</modules>
<packing>pom</packing>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
B:
<parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<relativePath>../A/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
其余的C、D、E的pom.xml
与B类似,我这样配置后,B提示我spring-boot-starter-web
要指定版本号,B的父级模块已经有了spring-boot-starter-web
这个依赖,并且版本号也已经可以从spring-boot-starter-parent
这个模块来获取,为什么会出现找不到版本号呢?
还有如果我不使用spring-boot-starter-parent
只使用spring-boot-starter-web
时项目依然可以运行这是为啥?spring-boot
项目不依赖spring-boot-starter-parent
吗?
说明pom关系没对应上,我理解不用整什么相对路径的,直接用IDE创建多模块项目吧