Best project structure for web app? [message #17726] |
Wed, 11 February 2004 19:19  |
Eclipse User |
|
|
|
So far we've been mounting our eclipse project directory from tomcat.
This requires that the project contain a WEB-INF directory with
lib/classes/etc in it. Eclipse is set to compile into WEB-INF/classes,
and everything works.
Project/
doc/
src/ (eclipse source dir)
WEB-INF/
classes/ (eclipse generates into here)
lib/
web.xml
.cvsignore (with "classes" included)
But I would like to have a nicer project structure that looks like this:
Project/
doc/ (hand written docs)
src/ (java source)
lib/ (dependancies)
web/ (jsp files)
etc/ (contains web.xml)
webapp/ (not in CVS)
[copied from web/]
WEB-INF/
classes/ [compiled from src/]
lib/ [copied from lib/ *except* for j2ee api jars]
web.xml [copied from etc/]
.cvsignore (contains "webapp")
Then I could have tomcat point to Project/webapp/. This would let me hide
the nasty WEB-INF directory, and as a bonus waring would be very simple.
My war file would then be a simple zip of webapp/.
This is straightforward to achieve with Ant, but it would require that I
execute an Ant target after every update. I'm not used to working this
way, but if folks have some advice for making this bearable I'm all ears.
Even so, I like the immediacy of simply *saving* a change and having
Tomcat pick up the change.
Ideally Eclipse would support some simple copy semantics. Does it? Can I
achieve what I want here? Is there a way to get Eclipse to execute an Ant
target on resource modification?
Thanks,
Josh
|
|
|
Re: Best project structure for web app? [message #17836 is a reply to message #17726] |
Thu, 12 February 2004 03:12   |
Eclipse User |
|
|
|
Originally posted by: jmordax.terra.es
Select your project, right button, properties, External Tool Builders,
New, ANT Build and fill it with your specific details.
Hope this helps,
Chemi.
Josh Rehman wrote:
>So far we've been mounting our eclipse project directory from tomcat.
>This requires that the project contain a WEB-INF directory with
>lib/classes/etc in it. Eclipse is set to compile into WEB-INF/classes,
>and everything works.
>
>Project/
> doc/
> src/ (eclipse source dir)
> WEB-INF/
> classes/ (eclipse generates into here)
> lib/
> web.xml
> .cvsignore (with "classes" included)
>
>But I would like to have a nicer project structure that looks like this:
>
>Project/
> doc/ (hand written docs)
> src/ (java source)
> lib/ (dependancies)
> web/ (jsp files)
> etc/ (contains web.xml)
> webapp/ (not in CVS)
> [copied from web/]
> WEB-INF/
> classes/ [compiled from src/]
> lib/ [copied from lib/ *except* for j2ee api jars]
> web.xml [copied from etc/]
> .cvsignore (contains "webapp")
>
>Then I could have tomcat point to Project/webapp/. This would let me hide
>the nasty WEB-INF directory, and as a bonus waring would be very simple.
>My war file would then be a simple zip of webapp/.
>
>This is straightforward to achieve with Ant, but it would require that I
>execute an Ant target after every update. I'm not used to working this
>way, but if folks have some advice for making this bearable I'm all ears.
>Even so, I like the immediacy of simply *saving* a change and having
>Tomcat pick up the change.
>
>Ideally Eclipse would support some simple copy semantics. Does it? Can I
>achieve what I want here? Is there a way to get Eclipse to execute an Ant
>target on resource modification?
>
>Thanks,
>Josh
>
>
|
|
|
|
|
Re: Best project structure for web app? [message #18189 is a reply to message #17726] |
Mon, 23 February 2004 15:13  |
Eclipse User |
|
|
|
Originally posted by: rajbsaini.yahoo.com
The problem with keeping different build directories for ant script and
eclipse is ant recompiles all .java while theya re already compiled by
the eclipe
I personaly dont want like WEB-INF or META-INF visible in the directory
structure.
I wrote a build file for each moduel which just need to assemble the
project (no need to compile as it is already done by JDT).
My small build files just copy the required files such as .jar, .xml
descriptors and web contents to the build.
You can create a jar, war or ear out of the build folder or mount is as
your webapps for the tomcat.
I use the diffeent output directory for a source folder feature of the
eclipse to achive the deployment direcotry structure.
Project/
EJB-Modules/
X-module/
src/
conf/
ejb-jar.xml
docs/
build.xml
Y-Module/
...
Web-Modules/
A-Module/
src/
conf/
web.xml
xxxx.tld
docs/
build.xml
lib/
x.jar
y.jar
dist/
conf/
application.xml
build.xml
<hidden)
build/
ejb/
module-x/
module-y/
web/
web-app-x\
WEB-INF\
classes\
lib\
.html
.jsp
Regards,
Raj
osh Rehman wrote:
> So far we've been mounting our eclipse project directory from tomcat.
> This requires that the project contain a WEB-INF directory with
> lib/classes/etc in it. Eclipse is set to compile into WEB-INF/classes,
> and everything works.
>
> Project/
> doc/
> src/ (eclipse source dir)
> WEB-INF/
> classes/ (eclipse generates into here)
> lib/
> web.xml
> .cvsignore (with "classes" included)
>
> But I would like to have a nicer project structure that looks like this:
>
> Project/
> doc/ (hand written docs)
> src/ (java source)
> lib/ (dependancies)
> web/ (jsp files)
> etc/ (contains web.xml)
> webapp/ (not in CVS)
> [copied from web/]
> WEB-INF/
> classes/ [compiled from src/]
> lib/ [copied from lib/ *except* for j2ee api jars]
> web.xml [copied from etc/]
> .cvsignore (contains "webapp")
>
> Then I could have tomcat point to Project/webapp/. This would let me hide
> the nasty WEB-INF directory, and as a bonus waring would be very simple.
> My war file would then be a simple zip of webapp/.
>
> This is straightforward to achieve with Ant, but it would require that I
> execute an Ant target after every update. I'm not used to working this
> way, but if folks have some advice for making this bearable I'm all ears.
> Even so, I like the immediacy of simply *saving* a change and having
> Tomcat pick up the change.
>
> Ideally Eclipse would support some simple copy semantics. Does it? Can I
> achieve what I want here? Is there a way to get Eclipse to execute an Ant
> target on resource modification?
>
> Thanks,
> Josh
|
|
|
Powered by
FUDForum. Page generated in 0.03561 seconds