4
votes

I've webapp that is currently deployed as a war to Tomcat7. I want migrate this webapp to Jetty. I explored Jetty but looks like there are too many options. The webapp uses Spring MVC and Camel. I'm using Maven to do builds, testing and deployment.

I'm looking for good options to quickly migrate this app to Jetty.

EDIT: My main interest is embedded Jetty. I'm assuming embedded Jetty should work fine with Spring.

Thanks.

2
Ideally, you "migrating" should be just taking your WAR file and dropping it into somewhere that Jetty will auto-deploy. Do you have any further requirements? This question is fairly open-ended.Christopher Schultz

2 Answers

3
votes

This is what I did to make this work.

  1. I Added the following plugin to my pom.xml

        <!-- plugin so you can run mvn jetty:war-run -->
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>7.5.4.v20111024</version>
    
    
            <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
                <webAppConfig>
                    <contextPath>/mycontextpath</contextPath>
                </webAppConfig>
                <configuration>
                    <webApp>${basedir}/target/{mywarname}.war</webApp>
                </configuration>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>8080</port>
                        <maxIdleTime>60000</maxIdleTime>
                    </connector>
                </connectors>
            </configuration>
        </plugin>
    
  2. Executed maven clean and install

    $mvn clean install -DskipTests

  3. Ran the war file using the Jetty plugin

    $mvn jetty:war-run

  4. In a separate window ran the tests

    $mvn test

0
votes

If you're using eclipse as your IDE and Maven to build then this FAQ from Eclipse website maybe a good place to start.

With the source code, can you deploy and run in Jetty as described?

Jetty scans its $JETTY_HOME/webapps directory at startup for web applications to deploy

The same should applied regardless of an IDE being involved