简体   繁体   English

包含ejb 3.1和jsf页面的依赖项jar

[英]Dependency jar containing ejb 3.1 and jsf pages

I have a web app project which is now growing in to separate web submodules containing their own ejbs and jsf webpages. 我有一个Web应用程序项目,现在正在成长为包含自己的ejbs和jsf网页的单独的Web子模块。

The project structure is going to look like something following. 项目结构看起来像下面的东西。

  • parent-project 父项目
  • common-module 通用模块
  • creditcard-module 的信用卡模块
  • bankpayment-module bankpayment模块
  • some-more-payment-modules ... 一些更多的支付模块...
  • war-module 战模块

Each module except common module has its own ejbs and jsf pages. 除通用模块外,每个模块都有自己的ejbs和jsf页面。

If possible I need each module to be a standalone war and build a big war with the war module. 如果可能的话,我需要每个模块成为独立的战争,并与war模块建立一场大战争。

EDIT 编辑

Current structure of the project 项目的当前结构

war module -- 
           --| persistenceunit |
           --| entities |
           --| ejbs |
           --| cdi managed beans |
           --| controllers |
           --| jsf-pages |
           --| resources |

The different business units are just separated by packages. 不同的业务部门只是按包分开。 Now it is required to be able to version the different business units separately ie different mvn projects for each. 现在,需要能够分别对不同的业务部门进行版本控制,即每个版本对应的mvn项目。

Structure to achieve: 结构实现:

Common module -- 
              --| persistenceunit |
              --| dao helpers |
              --| common ejb services |
              --| common managed beans |                  
              --| jsf-templates |
              --| common resources |
Creditcard module -- 
              --| related entities |
              --| ejb services |
              --| related managed beans |                  
              --| jsf-pages |
              --| specific resources |

And the same for other business modules, moreover one master war / ear module to contain all the wars. 与其他业务模块相同,此外,一个主战争/耳模块包含所有战争。

Important: is it possible to share persistence unit ? 重要提示:是否可以共享持久性单元? Will cdi work across the modules (at the end it is a single ear/war) ? cdi是否可以在各个模块之间工作(最后是单耳/战争)?

In essence the idea is to modulerise the project according to business needs and not purely technical layers. 本质上,想法是根据业务需求而非纯粹的技术层对项目进行模块化。

How should I achieve this with maven ? 我应该如何使用Maven做到这一点?

You may be able to accomplish what you want using Maven Web overlays: 您可能可以使用Maven Web覆盖来完成所需的操作:

http://maven.apache.org/plugins/maven-war-plugin/overlays.html http://maven.apache.org/plugins/maven-war-plugin/overlays.html

They let you have Web resources propagate through projects via dependencies, similar to how source files and classpath resources propagate through jar files and into war files via dependencies. 它们使您可以使Web资源通过依赖项在项目中传播,类似于源文件和类路径资源通过jar文件并通过依赖项传播到war文件的方式。

You can create an Enterprise Archive (.ear file) using the Apache Maven EAR Plugin : 您可以使用Apache Maven EAR插件创建企业存档 (.ear文件):

A Java EE application is delivered in an Enterprise Archive (EAR) file, a standard Java Archive (JAR) file with an .ear extension. Java EE应用程序以企业归档(EAR)文件交付,该文件是扩展名为.ear的标准Java归档(JAR)文件。 Using EAR files and modules makes it possible to assemble a number of different Java EE applications using some of the same components. 使用EAR文件和模块可以使用某些相同的组件来组装许多不同的Java EE应用程序。 No extra coding is needed; 无需额外的编码; it is only a matter of assembling (or packaging) various Java EE modules into Java EE EAR files. 这仅仅是将各种Java EE模块组装(或打包)到Java EE EAR文件中的问题。 (Source: Java EE 5 docs ) (来源: Java EE 5文档

Create a new module with packaging ear . 创建包装耳朵一个新的模块。 Use the maven-ear-plugin , configure the modules that you want to have assembled together. 使用 maven-ear-plugin配置要组装在一起的模块

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM