Packaging jar is invalid Aggregator project need pom as packaging

依然范特西╮ 提交于 2019-12-19 00:24:17

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

  • In My project I have different modules.
  • Each module have pom.xml in which packaging is a jar. 
  • And each pom refer to common parent.
  • In parent module there is also a pom.xml which includes all the modules.

    But when i tried to make the packaging in the pom.xml of parent module it shows the error that is "Packaging jar is invalid Aggregator project need pom as packaging".

    I want to make the executable jar of the application from maven so,what is the solution for this problem or is there is any other solution.

解决方法:

To make things short: if your parent-aggregator project don't contains source code (and it's a good practice), just add this to your parent pom.xml:

<packaging>pom</packaging>

If the parent project contains source code, I strongly suggest you to:

  • move this code in a new module (let's call it commons)
  • make commons a child module of your parent project
  • add the commons module as a dependency of all other modules requiring it (maybe all of them)
  • add <packaging>pom</packaging> in the parent pom.xml
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!