0

I've created a parent project and three maven module projects. When I added dependencies in the parent project, the dependencies were added to all module projects automatically. This is not what I want. I want to parent POM holds all dependencies defined and add the actual dependencies the module project as needed by providing groupId and artifactId. How can I stop m2eclipse automatically including the dependencies from parent project.

4

1 回答 1

0

build.dependencies和之间有区别build.dependencyManagement.dependencies

依赖关系定义了实际的依赖关系,而依赖关系管理只定义了(将)用于依赖关系的依赖版本。

其中任何一个都是继承的,但这很好。它允许在子项目中定义依赖项(正在管理的)时从父项内部执行依赖项管理。

请注意,有一种趋势是通过继承来避开 Maven 依赖管理,而改用组合(“导入依赖项”)。

于 2013-09-05T20:54:20.830 回答