SECTION: 950-IDEs TITLE: IntelliJ QUESTION: How do I run Jetty from IntelliJ IDEA? First set up a minimal jetty configuration in a directory in the source tree:

<?xml version="1.0"?>

<Configure class="org.mortbay.jetty.Server">

    <Set name="Debug" class="org.mortbay.util.Code" type="boolean">false</Set>
    <Call name="addListener">
        <Arg>
            <New class="org.mortbay.http.SocketListener">
                <Set name="Port">
                   <SystemProperty name="jetty.port" default="8080"/>
                </Set>
            </New>
        </Arg>
    </Call>

    <Call name="addWebApplication">
        <Arg>/test</Arg>
        <Arg>
           <SystemProperty name="jetty.home" default="./"/>src/webapp
        </Arg>
        <Set name="virtualHosts">
           < Array type="java.lang.String">
               <Item>localhost</Item>
            </Array>
        </Set>
    </Call>

</Configure>

Be sure that the Arg that sets the path to the webapp in the call to addWebApplication matches the location of your webapp.

The next step is to configure IntelliJ IDEA. For this, add the Jetty and and Jasper classlibs to the set of application libraries and add a new starter entry for Jetty:


Main-Class: org.mortbay.jetty.Server
Program parameters: path_to/jetty.xml
Working Directory: /path_your_source_root

This is all that is neaded to make IDEA run Jetty. You can debug your application like any "normal" application and make use of the new "hotswap" feature.

[Contributed by Philipp Meier 26-Mar-2004]