Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] setting up Eclipse project for embedded Jetty

Title: Re: [jetty-users] setting up Eclipse project for embedded Jetty
There may be a better or an 'official' way of doing this, but, if it helps, this is what I do:

1) I have the normal web.xml file in my WEB-INF directory, containing the invocation of
 the DefaultServlet initialized with the location of my development-environment static files,

2) I have a second file, which I name production-web.xml which has the same content
 except for directing the DefaultServlet to the production location of these resources.

3) I have a makewar.xml Ant file in which the target building the war archive looks like this:

<war basedir="war" destfile="mail.war" webxml="war/WEB-INF/production-web.xml">
       <exclude name="WEB-INF/**" />
       <webinf dir="war/WEB-INF/">
               <include name="classes/**" />
               <include name="**/*.jar" />
       </webinf>
</war>
...


In Eclipse I have added makewar.xml as one of the Builder tasks.

------------

Actually, I have an additional difference between my web.xml and production-web.xml files,
which some may find useful.

I'm using GWT in Eclipse, which has embedded in it a Jetty which uses
"org.mortbay.jetty..." classes, whereas I'm using "org.eclipse.jetty..." classes
in my production environment, so I cite the two different DefaultServlet class paths
in the two web.xml versions.

HTH

Chris Haynes        


On Friday, February 1, 2013 at 7:49:34 PM, Chris Lauwers wrote:
> Thanks, good to hear I was on the right track.

> The second part of my question has to do with how to manage this in
> Eclipse during development. I have my java source files in

>                 ~/Workspace/MyProject/src

> I'd like to keep the static content in

>                 ~/Workspace/MyProject/html

> During development, I want Jetty to look in the html directory in
> my project directory, but when deploying the server, I'd like to
> move the static content into the directory where the server is
> deployed. Is there a "standard" way to do this without having to
> change setResourceBase() right before creating the release build?

> Thanks,

> Chris

Back to the top