简体   繁体   English

如何使用Maven制作Java EE 6项目

[英]How to use Maven to make a Java EE 6 project

I have used Eclipse to make a EJB project , Dynamic Web project and then I have combined these to in a EAR project . 我使用Eclipse制作了EJB projectDynamic Web project ,然后将它们组合到EAR project Now I am learning Maven and I wonder how you manage how you do this? 现在我正在学习Maven,我想知道您如何管理此操作?

If I use an archetype that generates a javaee6-webapp then after what I understand you get a WAR archive....but that can only use the subset of the JavaEE6 specifiaction. 如果我使用可生成javaee6-webapp的原型,那么据我所知,您将获得WAR存档...。但是只能使用JavaEE6规范的子集。 I want to use the whole. 我想用整个。 So do I need to use one archetype for javaee6-ejb and one for javaee6-webapp, and then combine these in some way? 那么,我是否需要对javaee6-ejb使用一种原型,对javaee6-webapp使用一种原型,然后以某种方式组合它们?

If this is the case or there are other better approaces I would be happy to learn about it. 如果是这种情况,或者还有其他更好的解决方法,我将很乐意对此进行了解。

Or are the EJBs in a webapp project generated by an archetype compiled and packed as a library and added to the WEB-INF/lib folder? 还是由原型生成的webapp项目中的EJB被编译并打包为库并添加到WEB-INF / lib文件夹中? If so, does it have access to the full JavaEE6 API if deployed in a full profile app server? 如果是这样,如果部署在完整的配置文件应用程序服务器中,它是否可以访问完整的JavaEE6 API?

This article by Adam Bien might be interesting for you. 亚当·比恩(Adam Bien)的这篇文章可能对您很有趣。

Also, if I understand it correctly, you can use all the goods of Java EE 6 specification using WAR deployment. 另外,如果我对它的理解正确,那么可以通过WAR部署使用Java EE 6规范的所有商品。 You can use timers, remote interfaces, asynchronous invocation etc. in your WAR. 您可以在WAR中使用计时器,远程接口,异步调用等。
It just depends if you use Full vs Web Profile. 这取决于您使用的是完全配置还是网络配置文件。

There are few differences between EAR and WAR packaging but, in my opinion, the biggest added value of EAR is the separation of concerns and modules (business logic from web). EAR和WAR打包之间几乎没有区别,但是在我看来,EAR的最大附加价值是关注点和模块(业务逻辑与Web的分离)的分离。

要快速开始,您还可以使用如下http://seam-archetype.sourceforge.net/jbosscc-seam-archetype/1.4/javaee.html这样的Maven原型。

You have the right idea. 你有正确的主意。

Create all of your maven projects such as ejb-javaee6, webapp-javaee6, etc. Then IF you want, create an maven ear-javaee6 project to bundle them all together. 创建所有maven项目,例如ejb-javaee6,webapp-javaee6等。然后,如果需要,创建一个maven ear-javaee6项目,将它们捆绑在一起。 This EAR would reference your ejb and webapp. 该EAR将引用您的ejb和webapp。

Updated link: Eclipse has a plugin for maven that makes your life easier 更新的链接: Eclipse有一个maven插件 ,可以使您的生活更轻松

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

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