1
我有这两个文件POM:与子模块的Maven POM依赖管理
1)家长的pom.xml
...
<modules>
<module>web-module</module>
<module>interface-module</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${project.groupId}.${project.artifactId}</groupId>
<artifactId>interface-module</artifactId>
<version>${project.version}</version>
<type>ejb</type>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
2)儿童的pom.xml
<dependencies>
<dependency>
<groupId>${project.parent.groupId}.${project.parent.artifactId}</groupId>
<artifactId>interface-module</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>
</dependencies>
问题是:
为什么它无法解决由parent dependencyManagment管理的依赖关系,在Child中省略了版本?为什么我必须指定版本,而将dependencyManagment用于从正在聚合这些模块的Parent继承的子模块? 也许一些建议?
UPD: 原来,当儿童的groupId改变存在此行为,而不是被继承自父一... 基本上我有2子模块的家长之一,他们都是儿童父母之一。 当我更改Child模块中的groupId时,它会要求我在依赖管理期间指定版本,这有点奇怪。 任何想法,为什么maven是这样的?