Maven结构和Java EE应用程序

问题描述:

如何在Java EE应用程序中组织Maven模块?目前我们所做的是在父POM下有以下Maven模块:

How do you organize your Maven modules in a Java EE application? Currently what we do is have the following Maven modules under a parent POM:


  • ear

  • ejb

  • ejb-api

  • 核心

  • ear
  • ejb
  • ejb-api
  • core

ejb 模块仅包含EJB类,而核心模块包含所有其他实用程序类,包括实体。 ejb-api 是一个包含本地和远程接口的轻量级模块,用于包含在需要的单独应用程序中。 ear 用于制作EAR包并将其部署到应用程序服务器。

The ejb module contains only EJB classes, while the core module contains all other utility classes, including entities. The ejb-api is a lightweight module that contains local and remote interfaces, for inclusion in separate applications in needed. ear is used to make an EAR package and deploy it to application server.

如何构建应用程序?我特别感兴趣的是存储实用程序类和实体类的位置。

How do you structure your application? I am particularly interested in where you store your utility classes and entity classes.

Maven的概念是原型布局预定义的结构。我推荐 org.codehaus.mojo.archetypes 中的预定义原型。它们具有从桌面应用程序到服务器端应用程序(j2ee 1.3到Java EE 6)的原型。

Maven has the concept of archetypes that layout a pre-defined structure. I recommend the predefined archetypes from org.codehaus.mojo.archetypes. They have archetypes from desktop applications to server side applications (j2ee 1.3 to Java EE 6).