wood burning stoves
The moose likes EJB and other Java EE Technologies and the fly likes Directory structure for a J2EE application. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Directory structure for a J2EE application." Watch "Directory structure for a J2EE application." New topic

Directory structure for a J2EE application.

Prince Manchanda
Ranch Hand

Joined: Jun 25, 2001
Posts: 52
I have a j2ee application that consists of the:
jsps, images, html,
helper classes used both by the ejbs and the jsps
property files.
The application will be deployed as an EAR file that will contain the jar file and the war file.
I want to use ANT tool to automate the build and deploy of my application.
I want to know the ideal directory structure for keeping my code, property files and build scripts, both for the development machines and production machines.
Hope I am clear with my problem.

Thanks and Regards
P Manchanda
Sri Basavanahally
Ranch Hand

Joined: Oct 07, 2003
Posts: 75
What app server are you using ? Check out the app server's docs, it will have the info you need.

Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
I don't think the application server matters because you'll be creating .war/.jar/.ear files in any case (or the same structure but in exploded form).
TheServerSide has a thread titled "Writing a good build.xml" in case you're using Ant.
You could also take a look at how popular open source projects have organized their code.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sri Basavanahally
Ranch Hand

Joined: Oct 07, 2003
Posts: 75
You are right. I was just pointing to one of many places to get that information...
Prince Manchanda
Ranch Hand

Joined: Jun 25, 2001
Posts: 52
Many thanks for help. We are planning to use the WAS. I will surely go through the docs. But my main concern or question infact is that of the directory structure prior to creating jars/wars/ears. e.g. say on the dev machines, where the developers are developing their code, need to deploy/redploy it.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Doesn't websphere provide an assembly tool?
[ November 20, 2003: Message edited by: Pradeep Bhat ]

Bill Dudney
Ranch Hand

Joined: Sep 05, 2003
Posts: 234
Hi P Manchanda,
I'd suggest taking a look at Maven. I've not used it myself but I've heard lots of really good stuff about it.
If you want a simpler solution the sample code from my blog on J2EE AntiPatterns has a decent directory layout (IMO of course). The sample code for the JSF talk also has a more comprehensive layout. Both examples also encorperate Cactus which is a great tool for doing in container testing, as well as XDoclet which is also very helpful for building j2ee apps...
Hope this helps.

TTFN,<br /> <br />-bd-<br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/0471449156/qid=1064343733/sr=2-1/ref=sr_2_1/002-8375300-3666449" target="_blank" rel="nofollow">Jakarta Pitfalls</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471146153/qid=1064343733/sr=1-2/ref=sr_1_2/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">J2EE AntiPatterns</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471462071/qid=1064343733/sr=1-3/ref=sr_1_3/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">Mastering JavaServer Faces</a> | <a href="http://bill.dudney.net/roller/page/bill" target="_blank" rel="nofollow">Blog</a> | <a href="http://www.jroller.com/page/BillDudney" target="_blank" rel="nofollow">Eclipse Blog</a> | <a href="http://www.sourcebeat.com/TitleAction.do?id=2" target="_blank" rel="nofollow">Eclipse 3 Live</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: Directory structure for a J2EE application.
jQuery in Action, 3rd edition