Most projects can be launched by using the Run As.../Debug As... menu options:
This option is available, if your project contains a web.xml file. The launcher will automatically select the Web Application directory and launch the embedded Jetty.
To create a Launch Confiugration for your web project using Eclipse Jetty, just open to your Run/Debug configurations and click on "New launch configuration". Select the project (if it's not yet select). Usually you should be able to run and debug your project now.
The WebApp tab contains the most important options for your Jetty Launch Configuration: the project, the folder, that contains the static files and the WEB-INF directory, the path of the URL and HTTP and HTTPs ports.
When creating a new Launch Configuration the project and the Web App folder will be determined automatically. If this fails, you have to set the values manually. Select the Project (should be you WAR module) and scan or browse for the Web App folder. Eclipse Jetty works best, if you follow the Maven standard directory layout.
The Context Path is the first part of the path in the URL to access your application. If you leave it blank, it defaults to "/".
The HTTP Port usually defaults to 8080 for web applications. If you need, you can Enable HTTPs at the specified port (defaults to 8443). The HTTPs connection uses a self-signed certificate of the Jetty Eclipse Plugin, so you have to allow access to your applicatin in your browser.
The Options tab contains advanced settings of your Launch Configuration. It allows you to define the Jetty versions, lets you enable features and you can add configuration files manually.
The Jetty Eclipse Plugin comes with an integrated Jetty 8. It is tested and should work with most projects (but you will need at least Java 1.6). If you need, you can use a different Jetty installation. Download it from the Jetty homepage download section and extract it. Browse for the directory. The Eclipse Jetty Plugin will automatically detect the version of the Jetty (supported are currently 6.x - 9.x).
You can enable and disable some Jetty Features manually. Usually these features are disabled for faster startup times.
This enables support for Java Server Pages in order to let Jetty compile JSPs. If you don't need JSPs support, disable this option; you server will start faster.
This enables support for the Java Naming and Directory Interface. If you use this for a data source, for example, you have to specified a context file, with the data source. You will also have to mark the needed JARs as "Global" in the dependencies table. This checkbox just adds the needed JARs when launching Jetty. For more infos see the JNDI Howto.
The Eclipse Jetty Plugin comes with an enhanced launcher for the Jetty server (like the start.jar of your Jetty).
With the configuration options you can modify the contents of the context file.
When you shut down the Jetty server gracefully, this may need some time. If your application has a lot to do when shutting down, you can increase the timeout for this shutdown operation here.
A Jetty server maintains a thread pool for all actions. For example, each incoming connection gets one thread from the thread pool (even if it does not get processed). With this option, you can limit the thread pool. This reduces memory consumption and debugging becomes easier.
The acceptors of a Jetty are used to process requests. If not enough acceptors are available, the request has to wait. You can limit the number of acceptors to simulate high server load or make sure, that the server does not process more requests than necessary.
This option is reserved for a future enhancements and is currently not implemented. If you need this, or other features, you have to add the JARs of Jetty manually and mark them as "Global" in the dependencies table. Additionally you have to provide needed context files.
Before a Jetty server processes the web.xml file, it automatically loads a default file with some settings. With this option, you can override this behavior and define another defaults file.
A Jetty server maintains a cache for static resources to increase performance. This cache usually works well and even recognizes modified files. But under certain circumstances the reload of updated files does not work. If this happens to you, you can disable the cache with this option.
With the context configuration, you can add additional Jetty context files to the startup process.
The table contains the default Eclipse Jetty Launcher Context. This contains the configuration of the Eclipse Jetty Plugin. Additionally you can add more context files, that are processed in the specified order. You may need this, for example, to define a JNDI data source (see JNDI Howto for an example).
The Eclipse Jetty Plugin divides the project libraries into two categories: the Jetty libraries and the dependencies of the project. With the settings on the Dependency tab, you can alter this behavior.
If you are using Maven for your project and you have enabled the M2Eclipse Plugin, a scope is provided for each library. With this scope you can, e.g., distinguish between dependencies for the application and dependencies for the unit tests.
In the Include Maven Dependencies settings you can globally add and remove dependencies with the specified scope. By default, only dependencies with a scope of compile or runtime get added.
If you are not using Maven, or a dependency is unknown to Maven, the library does not contain a scope. With the Include Other Dependencies option, you can add or remove these libraries. If your project uses Maven and the M2E Plugin, this option is disabled by default, otherwise it is enabled.
The table shows all dependencies/libraries of the project. You can include and exclude the dependencies with the left checkbox. For example, it is sometimes necessary, that you manually add the database driver, because the dependency is set to "provided" by Maven (which is correct for the server), but with your development Jetty you need the dependency.
By default, all dependencies are loaded with the classloader of the web application and not with the System classloader of Java. You can change this behavior by selecting the right checkbox. When enabled, the Jetty launcher will load the specified dependency with the System classloader. You may need this, e.g., for your database driver, if you define a JNDI datasource.