简体   繁体   中英

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 . Now I am learning Maven and I wonder how you manage how you do this?

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. 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?

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? If so, does it have access to the full JavaEE6 API if deployed in a full profile app server?

This article by Adam Bien might be interesting for you.

Also, if I understand it correctly, you can use all the goods of Java EE 6 specification using WAR deployment. You can use timers, remote interfaces, asynchronous invocation etc. in your 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).

要快速开始,您还可以使用如下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. This EAR would reference your ejb and webapp.

Updated link: Eclipse has a plugin for maven that makes your life easier

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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