File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Packageing concept of Maven with Ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Packageing concept of Maven with Ejb" Watch "Packageing concept of Maven with Ejb" New topic

Packageing concept of Maven with Ejb

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 237
Hi all,

I am new to maven. I am using Maven 2.0
I am confused when packaging an Ejb application with maven.
In some sites I am seeing that in the root folder other than ejb or war there is another folder(or module) called ear.
My question why there is a ear module in the root folder whereas my root folder's goal is to make an ear ?

Please help.

Thanks in Advance,
Peter Johnson

Joined: May 14, 2008
Posts: 5852

I'm a little confused. By "root folder" are you implying that you have parent and child POMs, and that by "root folder" you really mean "parent POM"? Perhaps describing your POMs in a little more detail (how many you have, what artifact each is building) would help.

JBoss In Action
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 237
See, ultimately my goal is to make an .ear file. Right.
So according to my understanding I should have the below project structure which will give me the .ear file:


Here 'myproject' refers to root folder and is responsible for making .ear file. Also tell me when a src folder should be added in root folder.
Please clear my understanding.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

For an EAR, you'd generally have a project with dependent projects. The root project would be the controlling one and each of the child projects would be responsible for assembling some component. Each WAR and EJB jar would be a child project, for example. An EAR child project would then be responsible for collecting them all together and creating an EAR.

The root project shouldn't need a src directory, nor should the EAR child. You only need a src directory if you have source code to compile or include into the artifact being produced. In the case of an EAR project, all the inputs would probably be dependencies. If the EAR manifest files are dynamically created, there's no need for src. Only if you're providing a static manifest or a template would you need a src directory structure to keep it in.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Packageing concept of Maven with Ejb
It's not a secret anymore!