8

Today, I've been looking at Maven Multi-Module and EAR projects and they seem quite similar in that both seem to define an assembly of a collection of other projects - it almost seems like an EAR project should just be an alternate packaging for a multi-module project.

Have I misunderstood something? Or do these types of project work together?


Following Pascal's answer: Updated to clarify the question, hopefully that will help if it's not easy to understand; sorry it's maybe not phrased very well, the ear stuff is kinda new to me...

So say I have two projects, one producing a war and the other a utility jar. The war depends on the jar and I need to package them up into an ear for deployment. Should I use a project with a pom packaging type? I guess I have to use a project with an ear packaging type somewhere to produce the final artifact, so am I best using just a project with ear packaging, or projects with both pom and ear? If both, how?

4

2 回答 2

2

EAR 项目作为一个更大的聚合项目的一部分工作得很好。在那些你不想让 EAR 成为一个单独的项目的情况下;您始终可以通过程序集创建文件。

这种方法在某些情况下是有意义的。通常,您必须创建多个版本的 EAR,或者当您想要创建部署一个大型 EAR 文件但无需在创建后保留工件时。

我使用这种方法来处理要求所有可部署为 EAR 文件的公司标准,即使应用程序是单个 WAR 文件也是如此。程序集可以使用其单个 WAR 文件和部署描述符来创建 EAR。

于 2010-06-23T03:13:24.210 回答
0

我误解了什么吗?还是这些类型的项目一起工作?

我不确定我是否理解这个问题,但我很想回答他们一起工作:

  • 聚合模块允许聚合模块,它们必须有一个pom包装(并且只有pom模块可以有嵌套项目)。
  • EAR 模块只是一个带有ear包装的模块(并且具有特定的绑定),并且可以是多模块项目的一部分。

两者都有不同的目的。但他们一起工作。

于 2010-06-23T02:08:34.053 回答