Configuring Jetty6 in Eclipse with Maven2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Configuring Jetty6 in Eclipse with Maven2

JG Flowers
Hi folks,
I've donwloaded source for Ian Roughley's Struts 2 book, and wanted  to have a bash at debugging some of the code. I've been running the code using Maven 2 command mvn jetty:run.
There is a section in the Maven 2 pom.xml that uses the maven-jetty-plugin (6.01) See below:
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.0.1</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>
                    <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
                    <classesDirectory>${basedir}/target/classes</classesDirectory>
                </configuration>
            </plugin>

I've been strugging to understand how Jetty's configuration files can be setup to mimic  the Maven plugin, so I can launch server within Eclipse.
I found a link here  because Jetty 6 can't be added as a server adapter (only Jetty 5), but am strugggling to setup my version of the 'sampleapp.xml'
I've setup everything to step 4 of this process.
But I'm afraid I don't quite understand naming conventions.
I'm stuck with the directory structure: src/main/webapp. I think this is the default layout of Maven 2 and parent folder of META-INF/WEB-INF folders amongst others, which resembles website exampe I've referenced.
See screenshot:

My Acegi project directory layout differs from their Sample Application project.
Does there have to be a correlation between xml file name and folder?
ie <name>.xml and <name>_webroot (sampleapp.xml / sampleapp_webroot).
Or can I use src/main/webapp?
Is there something I need to do with Jetty.xml?
I say this, because exception that was  being thrown:
No such webapps resource file:
/C:/Documents%20and%20Settings/Jeremy/workspace/Jetty%20Server/webapps

So I tried changing the section in bold from /webapps.
    <Call class="org.mortbay.jetty.webapp.WebAppContext" name="addWebApplications">
      <Arg><Ref id="contexts"/></Arg>
      <Arg><SystemProperty name="jetty.home" default="."/>../Acegi_Security/src/main/webapp</Arg>
      <Arg><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Arg>
      <Arg type="boolean">True</Arg> 
      <Arg type="boolean">False</Arg> 
    </Call>

Then got a malformed url exception.

PS: What's the deal with extract war & copywebdir parameters. Do I need these? I don't know the mechanics the maven plugin is using and whether it creates a war when mvn jetty:run kicks in, or whether things just run out of directory unpackaged.

What am I doing wrong? Documentation on Jetty.xml is also pretty sparse. Any good guides anyone can recommend would be welcome too.
Cheers.