包装jar无效Aggregator项目需要pom作为包装 [英] Packaging jar is invalid Aggregator project need pom as packaging

查看:2777
本文介绍了包装jar无效Aggregator项目需要pom作为包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有不同的模块。

My project has different modules.


  • 每个模块都有一个指定jar包装的pom.xml。

  • 每个pom指的是普通父母。

  • 在父模块中还有一个包含所有模块的pom.xml。

当我尝试使用父模块的pom.xml打包时,它显示错误 - 打包jar无效聚合器项目需要pom作为包装。

When I tried to package using the pom.xml of the parent module, it shows the error - "Packaging jar is invalid Aggregator project need pom as packaging".

如何从maven制作应用程序的可执行jar?

What can I do to make an executable jar of the application from maven?

推荐答案

简而言之:如果你的父聚合器项目不包含源代码(这是一个好习惯),只需将它添加到你的父pom.xml:

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:


  • 在新模块中移动此代码(让我们称之为 commons

  • make commons 您父项目的子模块

  • 添加公共模块作为所有其他需要它的模块的依赖(可能全部)

  • 添加< packaging> pom< / packaging> 在父pom.xml中

  • 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

这篇关于包装jar无效Aggregator项目需要pom作为包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆