How do you set up jetty-start with Maven?

I'm trying to get Maven to automatically download all dependencies for jetty-start so I run this:

java start.jar etc/jetty.xml

But when I do this:

java start.jar --list-options

I get several missing modules that I have to manually add as dependencies to my Maven file. I've tried adding them, and I get stuck on finding an appropriate version of servlet-api that will provide javax.servlet.http.HttpServletResponse, even though the jar downloaded for jetty-servlet has javax/servlet/http/HttpServletResponse.class inside it. Here is the error:

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.eclipse.jetty.start.Main.invokeMain(
        at org.eclipse.jetty.start.Main.start(
        at org.eclipse.jetty.start.Main.main(
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletResponse
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(
        at java.lang.Class.getConstructor0(
        at java.lang.Class.newInstance0(
        at java.lang.Class.newInstance(
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(
        at org.eclipse.jetty.xml.XmlConfiguration.configure(
        at org.eclipse.jetty.xml.XmlConfiguration$
        at Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(
        ... 7 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletResponse
        at Method)
        at java.lang.ClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        ... 17 more

I've tried adding the org.eclipse.jetty.aggregate:jetty-all package to my dependency list, but the packages inside it are not detected by java start.jar --list-options, and therefore don't work.

There are a couple of pages of documentation that are helpful, but don't answer this question specifically:


You don't.

The jetty-start artifact is for use with the jetty distribution. There is no automatic download of dependencies when using the jetty-start artifact because the assumption is that you have the distribution on disk locally and are just trying to knit together your classpath for the server start.

With maven you use the jetty-maven-plugin if your looking to start a webapp during your build for testing or build purposes. With that plugin usage you will get the lionshare of the dependencies needed unless your trying to do something specific that demands additional dependencies in which case you add them to the section of the plugin declaration.


You need both jetty-start and jetty-all to do what you are trying to do - though you can also use a more specific set of artifacts than jetty-all as well.

Note that with a series of artifacts on the classpath you can't use java -jar, so instead will need to run org.eclipse.jetty.start.Main directly

For example:

java -cp start.jar:jetty-all.jar org.eclipse.jetty.start.Main --list-options

You probably want to create an assembly containing the required JARs (which are retrieved as Maven dependencies), and then add a start script to point to them.

You can find a more complete example here, which uses the assembly plugin and the Java Service Wrapper to run Jetty:

It may not answer your question, but here's how I launch Jetty in a main() method. I create an assembled app with the .war file included, and scan the filesystem to find the war, and launch Jetty with the copy of the war that was built and included in the distribution zip file.

    String warLocation = locateWarFile();

    WebAppContext webapp = new WebAppContext();


    webapp.setConfigurations(new Configuration[] {
            new WebInfConfiguration(),
            new EnvConfiguration(),
            new WebXmlConfiguration(),

    // launch Jetty's web server and serve requests..
    Server server = new Server();
    Connector connector=new SelectChannelConnector();
    server.setConnectors(new Connector[]{connector});

for the record, my maven dependencies:


The following POM file is configured to download and run the Apache Solr web application, using Jetty:

<project xmlns="" xmlns:xsi=""

Application is launched from Maven as follows:

mvn compile

For completeness

Solr requires additional configuration files. See the doco for details.

$ tree
|-- pom.xml
`-- src
    `-- main
        `-- solr
            `-- home
                `-- conf
                    |-- admin-extra.html
                    |-- elevate.xml
                    |-- mapping-FoldToASCII.txt
                    |-- mapping-ISOLatin1Accent.txt
                    |-- protwords.txt
                    |-- schema.xml
                    |-- scripts.conf
                    |-- solrconfig.xml
                    |-- spellings.txt
                    |-- stopwords_en.txt
                    |-- stopwords.txt
                    `-- synonyms.txt

Need Your Help

Passing Array of Structure to Functions

c arrays function structure

This is my first time posting as I'm very much stuck on this programming assignment. This chapter we began learning Structures. The last two weeks we learned Arrays and Functions, so the assignme...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.