简体   繁体   English

多模块Maven项目的依赖管理

[英]dependencymanagement for multimodule maven project

I have a multimodule maven project, when dependencymanagament tag is provided in parent pom, then m2e fails to import any maven dependency, although maven build is successful. 我有一个多模块Maven项目,当父pom中提供了dependencymanagament标记时,尽管maven构建成功,但是m2e无法导入任何maven依赖项。 But when dependenctmanagement tag is removed m2e is able to fetch all the dependency jars and my project becomes free from compilation error/ missing jars. 但是,当删除dependenctmanagement标记时,m2e能够获取所有依赖项jar,并且我的项目摆脱了编译错误/缺少jar。

Now, if I remove the dependencymanagement tag from parent pom then all child poms need to be updated with version details which I dont want to do, and its a bd practice also. 现在,如果我从父pom中删除了dependencymanagement标记,则所有子pom都需要使用我不想做的版本详细信息进行更新,这也是bd的做法。

So, what should i do to keep the dependencymanagement tag in parent pom, and as well as make elcipse fetch all dependency jars. 因此,我应该怎么做才能将dependencymanagement标记保留在父pom中,并使elcipse获取所有依赖项jar。 Tried with enable dependency/disable dependency options in m2e, and even restarting eclipse, they seem not to work. 尝试了在m2e中使用启用依赖项/禁用依赖项选项,甚至重新启动Eclipse,它们似乎不起作用。

See Pascal's answer to this question m2Eclipse dependencyManagement section doesn't show graph . 请参阅Pascal对这个问题的回答m2EclipsedependencyManagement部分不显示graph
Check that the dependencies are declared without version attributes in the sub-modules. 检查是否在子模块中声明了没有版本属性的依赖项。
The version attributes from dependencyManagement will only be inherited by the child if the child declares the managed artifact as a dependency. 如果子项将托管工件声明为依赖项,则只有该子项才能继承DependencyManagement的版本属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM