Is packaging type 'pom' needed when not using project aggregation (multimodule)?

南笙酒味 提交于 2019-12-03 10:58:40

As documented in the Inheritance section of the POM Reference:

The packaging type required to be pom for parent and aggregation (multi-module) projects.

So Maven's behavior seems correct to me (and the error message is nicely self explaining).

If you're just wanting to inherit dependencies then I don't think it needs to be type 'pom'. You could have it jar and simply specify it as a dependency of the project which you have as child. However you wouldn't then have the parent/child relationship which is what prevents your parent project being a type other than 'pom'.

To be clear, you inherit the dependencies of all your dependencies ( transitive dependencies ).

As noted by Pascal, the behaviour is correct.

If you're still looking for means to share dependencies between modules, you can consider bundling up the dependencies in question into a pom, and then having your modules both depend on that new "dependencies" pom.

See Maven Book Section 3.6.1 for more details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!